Timestamp

G

Guest

I am trying to use the timestamp code but it is not working. I have added a
field to my table Jobs called LastModified and then added it to the form.

My code looks like this:

Private Sub Form_BeforeUpdate(Cancel As Integer)

Jobs.[LastModified] = Now()

End Sub

I am entering this code on the Forms before update field. Is this correct
or should I be entering it on the LastModified's update field.
 
G

Guest

That still does not work. When is it suppose to populate the field
"LastModified" with the date? After I press the save button or when I exit
and the next time I come back to the job it will be there? If it is any of
those two....its not working. I have searched on this topic and everything I
have found is exactly what I am doing. Is there another way to go about this?

Ofer said:
Try
Me.[LastModified] = Now()

--
\\// Live Long and Prosper \\//
BS"D


tcorlew said:
I am trying to use the timestamp code but it is not working. I have added a
field to my table Jobs called LastModified and then added it to the form.

My code looks like this:

Private Sub Form_BeforeUpdate(Cancel As Integer)

Jobs.[LastModified] = Now()

End Sub

I am entering this code on the Forms before update field. Is this correct
or should I be entering it on the LastModified's update field.
 
D

dcichelli

I think your problem is that you are trying to write the time stamp to
the underlying table, and not an actual field on the form.

Why don't you create a field for your "LastModified" date on the form
(it can be set to hidden if you want), then, you can do:


Private Sub Form_BeforeUpdate(Cancel As Integer)
'set last modified date on form named "frm_Jobs"
Forms!frm_Jobs!LastModified = Now()
End Sub

You need to make sure that the Name property of the LastModified
control is actually set to "LastModified" for this to work.


That still does not work. When is it suppose to populate the field
"LastModified" with the date? After I press the save button or when I exit
and the next time I come back to the job it will be there? If it is any of
those two....its not working. I have searched on this topic and everything I
have found is exactly what I am doing. Is there another way to go about this?

Ofer said:
Try
Me.[LastModified] = Now()

--
\\// Live Long and Prosper \\//
BS"D


tcorlew said:
I am trying to use the timestamp code but it is not working. I have added a
field to my table Jobs called LastModified and then added it to the form.

My code looks like this:

Private Sub Form_BeforeUpdate(Cancel As Integer)

Jobs.[LastModified] = Now()

End Sub

I am entering this code on the Forms before update field. Is this correct
or should I be entering it on the LastModified's update field.
 
G

Guest

I know this is a bit late reply, but late better than never !
Do as follows:
Step 1: add a field to your table, name it "Last Updated", Data Type:
Date/Time.
Step 2: add the field "Last Updated" to your form (drag and drop from field
list).
Step 3: create a new macro, name it "Last Updated". It should look like this:
- Action: Setvalue
- Item: [Forms]![your form name]![Last Updated]
- Expression: Now() (DO NOT PLACE AN EQUAL SIGN BEFORE THE EXPRESSION)
Step 4: set the "Before Update" property of your form to the macro "Last
Updated".
Step 5: send me a thank you reply!
 
B

BruceM

I'm not sure all of that is necessary. Me.LastModified = Date in the form's
Before Update event should be sufficient. Every change will trigger the
event, so a confirmation message box may be wanted.

Healthcare Executive said:
I know this is a bit late reply, but late better than never !
Do as follows:
Step 1: add a field to your table, name it "Last Updated", Data Type:
Date/Time.
Step 2: add the field "Last Updated" to your form (drag and drop from
field
list).
Step 3: create a new macro, name it "Last Updated". It should look like
this:
- Action: Setvalue
- Item: [Forms]![your form name]![Last Updated]
- Expression: Now() (DO NOT PLACE AN EQUAL SIGN BEFORE THE EXPRESSION)
Step 4: set the "Before Update" property of your form to the macro "Last
Updated".
Step 5: send me a thank you reply!

tcorlew said:
I am trying to use the timestamp code but it is not working. I have
added a
field to my table Jobs called LastModified and then added it to the form.

My code looks like this:

Private Sub Form_BeforeUpdate(Cancel As Integer)

Jobs.[LastModified] = Now()

End Sub

I am entering this code on the Forms before update field. Is this
correct
or should I be entering it on the LastModified's update field.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top