Unanswered: Displaying a message box and closing a form
I have two forms, in the first form the user enters data into a text box, I then have a button that opens another form, this form is linked to a query and finds the record based on what the user has entered into the text.
I'm trying to add in some code so when no record is returned a message box appears and the form closes automatically. When there is no record then my primary key on the second form automatically becomes "0".
In the form load section of the second form I have the following:
If VoucherNo = 0 Then
MsgBox "There is no record to show"
It only seems to half work. The message box appears but when I click Ok on the message box the form loads up instead of closing down.