My code will not run

lmcc007

Registered User.
Local time
Today, 04:49
Joined
Nov 10, 2007
Messages
635
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:

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.

Now when I click the OK button it does nothing.

What is wrong? Should the code be written another way?
 
Please do not delete posts because you got it to work. If you got it to work then do EVERYONE a favor and post your solution here so that it could help someone else in the future (that is what forums are for, not just to solve your issue one time).
 

Users who are viewing this thread

Back
Top Bottom