catchthewind
New member
- Local time
- Today, 14:53
- Joined
- Aug 6, 2008
- Messages
- 2
I'm an access newbie, and have found this forum very helpful so far.
In my project, I have a form with a toggle button that says "add a new record" that should open the form "ECPMaster" so I can enter the new data when I click on it. My problem is that I'm getting an "Invalid use of null" error message. After the message I click OK and the form opens and seems to be working correctly. I can't figure out why I'm getting the error message though. There is no error number shown or debug button to show me the code that is causing the error. I have another toggle button, "edit record", that opens the same form and allows me to edit records and I'm not getting the "Invalid use of Null" error message then.
Does anyone know how I can fix this error or how to locate what the cause of the error is? Here's my code for the "add" and "edit" toggle forms:
Private Sub Toggle2_Click() 'Open ECPMaster form to create new ECN
DoCmd.Echo False
DoCmd.OpenForm "ECPMaster", acNormal, , , acFormAdd
''Disables navigation buttons
Form_ECPMaster.FirstRecord.Visible = False
Form_ECPMaster.LastRecord.Visible = False
Form_ECPMaster.PreviousRecord.Visible = False
Form_ECPMaster.NextRecord.Visible = False
DoCmd.Maximize
DoCmd.Echo True
Toggle2 = False
End Sub
Private Sub Toggle3_Click() 'Opens ECPMaster Form in Edit mode
DoCmd.Echo False
DoCmd.OpenForm "ECPMaster", , , , acFormEdit
Form_ECPMaster.AllowAdditions = False
DoCmd.Maximize
DoCmd.Echo True
Toggle3 = False
End Sub
In my project, I have a form with a toggle button that says "add a new record" that should open the form "ECPMaster" so I can enter the new data when I click on it. My problem is that I'm getting an "Invalid use of null" error message. After the message I click OK and the form opens and seems to be working correctly. I can't figure out why I'm getting the error message though. There is no error number shown or debug button to show me the code that is causing the error. I have another toggle button, "edit record", that opens the same form and allows me to edit records and I'm not getting the "Invalid use of Null" error message then.
Does anyone know how I can fix this error or how to locate what the cause of the error is? Here's my code for the "add" and "edit" toggle forms:
Private Sub Toggle2_Click() 'Open ECPMaster form to create new ECN
DoCmd.Echo False
DoCmd.OpenForm "ECPMaster", acNormal, , , acFormAdd
''Disables navigation buttons
Form_ECPMaster.FirstRecord.Visible = False
Form_ECPMaster.LastRecord.Visible = False
Form_ECPMaster.PreviousRecord.Visible = False
Form_ECPMaster.NextRecord.Visible = False
DoCmd.Maximize
DoCmd.Echo True
Toggle2 = False
End Sub
Private Sub Toggle3_Click() 'Opens ECPMaster Form in Edit mode
DoCmd.Echo False
DoCmd.OpenForm "ECPMaster", , , , acFormEdit
Form_ECPMaster.AllowAdditions = False
DoCmd.Maximize
DoCmd.Echo True
Toggle3 = False
End Sub