Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Wednesday, November 27, 2024 
 
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!
 Architect Forums - SalesLogix Scripting & Customization
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.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Default DateTime field to current date
Darren Savery
Posts: 51
 
Default DateTime field to current dateYour last visit to this thread was on 1/1/1970 12:00:00 AM
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!
[Reply][Quote]
Carlos H. Treviño
Posts: 10
 
Re: Default DateTime field to current dateYour last visit to this thread was on 1/1/1970 12:00:00 AM
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
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Default DateTime field to current dateYour last visit to this thread was on 1/1/1970 12:00:00 AM
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.
[Reply][Quote]
Darren Savery
Posts: 51
 
Re: Default DateTime field to current dateYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 01 Mar 07 5:51 AM
fiogf49gjkf0d
Carlos / Jeremy,

Thanks for your help. I've got it working now

Darren
[Reply][Quote]
 Page 1 of 1 
  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!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/27/2024 4:30:00 AM