I have an EventNote form that can be opened by clicking on the Note icon from another form or it can be opened when in EventDetail. I put the below code on the OK button:
The reason I put "If CurrentProject.AllForms("fdlgEventDetail").IsLoaded Then" in because of Error 2450. That is:
Now when I click the OK button it does nothing.
What is wrong? Should the code be written another way?
Code:
' User wants to save and close the form
If CurrentProject.AllForms("fdlgEventDetail").IsLoaded Then
If Not Me.NewRecord Then
DoCmd.Close acForm, "fdlgEventNote", acSavePrompt
Forms!fdlgEventDetail!txtAddNotes.Value = "N"
Else
DoCmd.Close acForm, "fdlgEventNote", acSavePrompt
End If
End If
The reason I put "If CurrentProject.AllForms("fdlgEventDetail").IsLoaded Then" in because of Error 2450. That is:
Run-time error '2450'"
Microsoft Office Access can't find the form 'fdlgEventDetail' referred to in a macro expression or Visual Basic code.
Microsoft Office Access can't find the form 'fdlgEventDetail' referred to in a macro expression or Visual Basic code.
Now when I click the OK button it does nothing.
What is wrong? Should the code be written another way?