Auto Date/Time

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

I need to come up with a way that will automatically
updates a "Date Time Stamp" field within a record after a
change has been made.

The format should be something like this:
MM-DD-YY; HH:MM:SS (based on a 24-hour system).

Is something like this possible?


Thanks! Any advide is appreciated!

Tom
 
I know this is possible, I did this on a database I
created sometime ago, I'll see if I can find my files and
see how I did it and let you know.
 
John:

Thanks for the reply... I'm not entirely sure what type
of control I should add.

For right now, I have chosen an UNBOUND textbox. In the
[Event Procedure], I have added...

Private Sub Text12_BeforeUpdate(Cancel As Integer)
Me.txtDateTimeStamp = Now()
End Sub

while "Text12" in the Name of the textbox in the "Other"
tab in the properties.

At this time, the DTS doesn't get updated when I make
changes to other data values in the form.

What am I doing wrong?

Thanks again,
Tom
 
The textbox should be bound to the field that you are storing the timestamp
in. The field will be updated when the current record is saved. Look in
the help files for the order of events for an explanation of when the events
actually occur.

JMR



Tom said:
John:

Thanks for the reply... I'm not entirely sure what type
of control I should add.

For right now, I have chosen an UNBOUND textbox. In the
[Event Procedure], I have added...

Private Sub Text12_BeforeUpdate(Cancel As Integer)
Me.txtDateTimeStamp = Now()
End Sub

while "Text12" in the Name of the textbox in the "Other"
tab in the properties.

At this time, the DTS doesn't get updated when I make
changes to other data values in the form.

What am I doing wrong?

Thanks again,
Tom


-----Original Message-----
Put a control on your form and link it to your Date Time Stamp Field. You can
make the control invisible.

In the BEFORE UPDATE event of the form set the control's value to NOW(). The
code would look something like:

Private Sub Form_BeforeUpdate(Cancel As Integer)
ME.txtDateTimeStamp = Now()
End Sub

.
 
Add a BOUND textbox. The textbox is bound to your field.

Then in the Before Update event of the FORM (not the control) put code similar
to that I posted. If your control is named Text12 (not very descriptive is it)
then
Me.Text12 = Now()
is the code your should run in the Before Update event of the form.
John:

Thanks for the reply... I'm not entirely sure what type
of control I should add.

For right now, I have chosen an UNBOUND textbox. In the
[Event Procedure], I have added...

Private Sub Text12_BeforeUpdate(Cancel As Integer)
Me.txtDateTimeStamp = Now()
End Sub

while "Text12" in the Name of the textbox in the "Other"
tab in the properties.

At this time, the DTS doesn't get updated when I make
changes to other data values in the form.

What am I doing wrong?

Thanks again,
Tom
-----Original Message-----
Put a control on your form and link it to your Date Time Stamp Field. You can
make the control invisible.

In the BEFORE UPDATE event of the form set the control's value to NOW(). The
code would look something like:

Private Sub Form_BeforeUpdate(Cancel As Integer)
ME.txtDateTimeStamp = Now()
End Sub

.
 
John, I have been following this thread with interest as I have a similar
problem. I am very new to Access and would ask you to pardon my ignorance
here, but how do you create a Bound textbox i.e a textbox Bound to another
textbox? Or have I misunderstood what you were saying here?

Regards,

Del.


John Spencer (MVP) said:
Add a BOUND textbox. The textbox is bound to your field.

Then in the Before Update event of the FORM (not the control) put code similar
to that I posted. If your control is named Text12 (not very descriptive is it)
then
Me.Text12 = Now()
is the code your should run in the Before Update event of the form.
John:

Thanks for the reply... I'm not entirely sure what type
of control I should add.

For right now, I have chosen an UNBOUND textbox. In the
[Event Procedure], I have added...

Private Sub Text12_BeforeUpdate(Cancel As Integer)
Me.txtDateTimeStamp = Now()
End Sub

while "Text12" in the Name of the textbox in the "Other"
tab in the properties.

At this time, the DTS doesn't get updated when I make
changes to other data values in the form.

What am I doing wrong?

Thanks again,
Tom
-----Original Message-----
Put a control on your form and link it to your Date Time Stamp Field. You can
make the control invisible.

In the BEFORE UPDATE event of the form set the control's value to NOW(). The
code would look something like:

Private Sub Form_BeforeUpdate(Cancel As Integer)
ME.txtDateTimeStamp = Now()
End Sub

Tom wrote:

CAT:

Thanks! I truly would appreciate that.

Tom

-----Original Message-----
I know this is possible, I did this on a database I
created sometime ago, I'll see if I can find my files and
see how I did it and let you know.
-----Original Message-----
I need to come up with a way that will automatically
updates a "Date Time Stamp" field within a record after
a
change has been made.

The format should be something like this:
MM-DD-YY; HH:MM:SS (based on a 24-hour system).

Is something like this possible?


Thanks! Any advide is appreciated!

Tom


.

.

.
 
Back
Top