AfterUpdate problem (1 Viewer)

twinupshot

Registered User.
Local time
Today, 09:23
Joined
Jan 10, 2002
Messages
22
I Can't figure out why this doesn't work on a form that I want to populate the Timestamp field when they edit the record. Looks like it works for others that have posted.
Do I need to add a New Reference to the reference Libary?
I'm running Access2k

I get an error box stating the procedure declaration does not match description of event or procedure having the same name.

What am I missing?

Private Sub Form_AfterUpdate()
Me.Timestamp = Now()
End Sub

Bryan
 

RuralGuy

AWF VIP
Local time
Today, 02:23
Joined
Jul 2, 2005
Messages
13,825
To start with, you probably want the code in the BeforeUpdate event of the form rather than the AfterUpdate event. The record has already been updated by the AfterUpdate event. What sort of field is the TimeStamp control bound to? Is it a Date/Time field? Now() includes both Date and Time information.
 

twinupshot

Registered User.
Local time
Today, 09:23
Joined
Jan 10, 2002
Messages
22
Thanks for the reply.

I've tried the BeforeUpdate() as well. Same error. The Timestamp field is a date field.
 

RuralGuy

AWF VIP
Local time
Today, 02:23
Joined
Jul 2, 2005
Messages
13,825
Do you have the TimeStamp field displayed on the form in a TextBox control named Timestamp? If so then change the name of the control to txtTimeStamp and change your code to:
Me.txtTimeStamp = Now()

If you do not have a control displaying the field then your code should be:
[Timestamp] = Now()
 

twinupshot

Registered User.
Local time
Today, 09:23
Joined
Jan 10, 2002
Messages
22
Thanks for the reply.

I tried both ways you suggested. Same Error. I even tried using the Date() instead of Now(), no help. I tried it in BeforeUpdate and AfterUpdate, no change.

I know I'm overlooking something preventing my code to work and I just can't see it.
 

RuralGuy

AWF VIP
Local time
Today, 02:23
Joined
Jul 2, 2005
Messages
13,825
Do you have any MISSING references? From viewing code goto Tools>References and see if any have a MISSING in them. If so then just uncheck it and recompile. Do you have a TextBox displaying the TimeStamp?
 

twinupshot

Registered User.
Local time
Today, 09:23
Joined
Jan 10, 2002
Messages
22
I made a test(new) form and got the code to work.
For some reason it is not working on the existing form. I don't feel the existing form is corrupt because other code works fine.

I had it as a text box on the form, but I also tried it off using the Me.[Timestamp] = Now()

It is something with the form itself, but what?
 

twinupshot

Registered User.
Local time
Today, 09:23
Joined
Jan 10, 2002
Messages
22
Yes the autocorrect is off and I have done several compact and repairs.
The only thing that I have noticed is when I select the Event procedure and Code builder and the VB box comes up, I start typing Me.etc... the VB suggestion box doesn't come up with a list of code choices. It does on other forms but not this one. It acts like it doesn't recognize what I'm typing in.
I can only guess that the form is, in fact, corrupted in some way.
 

twinupshot

Registered User.
Local time
Today, 09:23
Joined
Jan 10, 2002
Messages
22
Thanks for the help.

I have started to recreate the form and it appears this will fix the problem.

Bryan :rolleyes:
 

Users who are viewing this thread

Top Bottom