Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have a bit of code (received grat

Status
Not open for further replies.

aexley

Technical User
Jul 9, 2001
147
GB
I have a bit of code (received gratefully from a tektips forum) that I want to sequentially increment an ID field.

If Me.NewRecord Then

...
...

If DMax("Contact ID", "Contact Information") = 0 Then
Me.[Contact ID] = 1
Else
Me.[Contact ID] = DMax("Contact ID", "Contact Information") + 1
End If

I have it activated on the OnLoad event - trouble is I'm getting a missing operator error but I don't know why. Also I can have more than 1 'Contact' per 'Site' but it doesn't activate when I move to a new record on my 'Contact' form.

Any ideas?

Thanks in advance.

aexley
 
P.S. Sorry about the unclear title - Monday morning fever I think.

:-/

aexley
 
Because it's in the wrong event???

Moving to a new record is the On_Current event, not On_Load.....

Craig
 
Bingo!

Perfect, thank you. The other error was just my sloppy typing.

Many thanks,

aexley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top