Text boxes used for Date and Time

L

Linda

Hi,

I am using access 97 and I want to be able to put a date and time on the
form of when I update a table that the form uses. I need the date and time
to appear when a user opens the form. I need the date and time to change
only when i update the tables or when i enter the updated date and time.
I've tried to use an unbound object but that does not work. I've also
created a separate table to have just date and time fields in it but i get an
error when i point the control source to it, error is #Name?
Any suggestions?

Thanks
Linda
 
D

Douglas J. Steele

You can display the date and time in an unbound textbox, then put logic in
the form's BeforeUpdate event to change the field in the recordset.
 
L

Linda

So doing this will keep the date and time that i entered from the last time?
Will you be able to provide the coding for that?

Thanks
Linda
 
D

Douglas J. Steele

Private Sub MyTextBox_AfterUpdate()

Me.MyTextBox.DefaultValue = Chr$(34) & Me.MyTextBox & Chr$(34)

End Sub

will set the default for the current session.

If you know what date you want the default to be, set the DefaultValue in
the form's Load event.
 
L

Linda

How does that save the date and time so that the next user can see when the
last update was?
 
D

Douglas J. Steele

You'll have to store the data in a table, and then set the default in the
form's Load event.
 
L

Linda

But will the data be replaced with the new date and time? You see I want to
be able to enter the date and time on the form. I have a table already
assigned to the form, how do I get the text box to enter the data in another
table? And also, I will need to be the only person abopt to enter the date
and time.
 
D

Douglas J Steele

Default values do not affect existing data.

I don't understand what you mean by entering the data in another table. (To
be honest, it's really not at all clear to me exactly what you're looking
for: perhaps you should try explaining in more details)
 
Top