11/27/2024 6:23:55 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
|
|
|
|
Default DateTime field to current date
Posted: 28 Feb 07 10:32 AM
|
fiogf49gjkf0d Hi,
I know this is probably really easy, but I cannot for the life of me get my script to work. I have a field called 'StartDate' on my 'ticket_detail' form. I would love to have it populated with the current date when a user opens a new ticket. However, if it already has a date, it will be left alone.
I tried adding the following code to the end of the script but to no avail :
Sub StartDate(Sender) If StartDate.Text = "" then StartDate.Text = Now End If End Sub
Can anyone help me with this?
Thanks! |
|
|
|
Re: Default DateTime field to current date
Posted: 28 Feb 07 11:06 AM
|
fiogf49gjkf0d I usually manage date fields with a datetime picker control and then:
If dtStartDate.DateTime = #12:00:00 AM# Then dtStartDate.DateTime = Now End If |
|
|
|
Re: Default DateTime field to current date
Posted: 28 Feb 07 3:54 PM
|
fiogf49gjkf0d 1) DateTimePicker controls are the red-headed step-child of datetime controls. I never use them. 2) Use the Form's OnChange event to call your StartDate() sub. For every add or edit of the view, the date control will be populated. You can limit this to just during adds or just during edits but that takes a little extra work. 3) Working with DateTime vs. Text takes a completely different way of thinking. If you think in DateTime, use it, otherwise .Text is easier to wrap your brain around. 4) FormatDateTime(vbShortDate, Now) will print a date like 2/28/2007 instead of including the time. When time isn't necessary, I generally use this. |
|
|
| |
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|