Error Message on DMax +1

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.
 
J

John Vinson

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.
 

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