Error message in Command Button code

  • Thread starter Thread starter ShellyInMN
  • Start date Start date
S

ShellyInMN

Guest
I have created command buttons to enter event registration information after biographical information has been completed. When I click on the button I get the following error message:

"Microsoft Office Access cannot find the field '|' referred to in your expression."

This is the On Click code that I have in there. Can anyone spot the error of my ways?

Private Sub RegisterButton_Click()
On Error GoTo Err_RegisterButton_Click
If IsNull(Me![AttendeeID]) Then
MsgBox "Enter attendee information before registering for an event."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenForm "Registration", , , "[Registration]![RegistrationID]=Forms![Attendees]![Attendees Subform].form![RegistrationID]"
End If

Exit_RegisterButton_Click:
Exit Sub

Err_RegisterButton_Click:
MsgBox Err.Description
Resume Exit_RegisterButton_Click
End Sub

Thanks!
 
Can you use break points to find exactly which line is causing the error?
My guess would be:

DoCmd.OpenForm "Registration", , , "[Registration]![RegistrationID]=Forms![Attendees]![Attendees Subform].form![RegistrationID]"

Make sure all your field names are typed exactly as they appear in the table.
 

Users who are viewing this thread

Back
Top Bottom