Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to close a form in sub Form_Open()

Status
Not open for further replies.

xenofoob

Programmer
Oct 4, 2004
28
NL
Hello,

My Title is clear enough I hope ^o^

This is my piece of code:
Code:
Private Sub Form_Open(Cancel As Integer)
    If IsNull([factuur_datum]) Then
      'null
    Else
        Dim value As Integer
        value = MsgBox("Date = Null", vbOKCancel)
        If value = 2 Then
            DoCmd.Close
        End If
    End If
End Sub

Explaination:
This piece of code checks if the date field is empty or not. If not the user gets a confirmbox. When clicking the cancel button the form has to close.

Via this code I get an error message: "Microsoft Office Access can't find the form 'FactuurInvoeren' referred to in a macro expression or Visual Basic code."

How to close the form without any warnings or messages?

Thanks a lot!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top