Record data time in a text box

rookie_user1

Registered User.
Local time
Today, 11:42
Joined
Jul 14, 2006
Messages
22
Hi i would like to retain the date and time once i select a button on my form, i have a macro that puts the date and time into a text box but when i closed the form i loose the date and time from the text box, how do i keep the date and time so when i open the form again i see it.
 
Add a text box in the table, and link it with the text box in the form.
 
Can you explain a bit more ?
 
forget the macro...

in the on click event procedure of your command button put in the following code:

*DateTime = Date & " ~ " & Time

substitute *DateTime for the name of the 'datetime field' in your table, then format the textbox to create the correct LongDate/ShortDate etc.... use any separator you want in " ~ "
 
Your form is linked on the table (I suppose).
Every field in th form is linked on the field in the table (CONTROL SOURCE
properties). Add a new text box, (Data Type = Date/Time, Input mask =
General Date), in your table and link it with the field in the form (Control Source).
 
This works fine for the current date and time but i want to save the date and time when the button is clicked and then retrive it when the form is closed and open again... what the code below gives me is the date and time now


(in the on click event procedure of your command button put in the following code:

*DateTime = Date & " ~ " & Time

substitute *DateTime for the name of the 'datetime field' in your table, then format the textbox to create the correct LongDate/ShortDate etc.... use any separator you want in " ~ ")
 
You need to make a new table that will record the date and time the user submits.
 
I may have went the long way to get this to work but i did in the end so here is how i did it.

I created a table with Date and Time columns and set the default for them to Date() time() to always get the the current date and time from the system.

Then i created a update query on that table to set both date and time to the the date/time when the button was click on this is called from the macro (Action) = RumSQL put my sql script into the macro,

I called me macro from within the onclick procedure and once i select the button am prompt to say yes to update the record as its a update query

My report refresh in excel and the form closes when complete.

Once i open the form up again i see the date and time it was last refreshed or in my case the Name of the day also...
 

Users who are viewing this thread

Back
Top Bottom