Error Message on DMax +1

  • Thread starter Thread starter Tina
  • Start date Start date
T

Tina

Thanks for the assistance. I typed in the following code
in the System_Id control under default Value and got an
error message in the control box:

=DMax("[System_ID]", "[System Information]")+1

When I click back to the regular form, #Error is in the
control box for System_Id. Am I missing something here?

My Form name is Updates
Table Name is System Information
Field Name is System_ID

The control where I want the next System Id number to
appear is called System ID.
 
Thanks for the assistance. I typed in the following code
in the System_Id control under default Value and got an
error message in the control box:

=DMax("[System_ID]", "[System Information]")+1

When I click back to the regular form, #Error is in the
control box for System_Id. Am I missing something here?

My Form name is Updates
Table Name is System Information
Field Name is System_ID

The control where I want the next System Id number to
appear is called System ID.

I'd suggest putting the DMax() into the Form's BeforeInsert event
instead. Invoke the Code Builder and edit the code to
'
Private Sub Form_BeforeInsert(Cancel as Integer)
Me!txtSystem_ID = DMax("[System_ID]", "[System Information]")+1
End Sub

assuming that the System_ID is bound to a textbox named txtSystem_ID.
 
Back
Top