I have a subform that pops up and contains listboxes for a selection of records that meet certain criteria in an Access 2000 db. An option from each list box must be selected to build a number that appears on the main form. However, if the user doesn't select any options or just a few, etc, they are allowed to go back to the main form.
I want a message to pop up to inform them that they will not get the desired results if they don't. I have created this error message, but when the form is tested, I can get it to display a message if they click the accept button except that the message is displayed before the subform closes and then again on the main form. If I select options as required to generate the number, I still receive the message. I cannot figure out what's going on with this.
Can anyone please help?
Private Sub Command21_Click()
'The error should check that a selection has been made in each option
If Me!QTB_CompItemID <> " " Then
Call BuildNumber
DoCmd.Close
Else
GoTo Error_CompItemID
Resume
End If
Error_CompItemID:
MsgBox "You must make a selection for each blank field on this form to generate the 25-digit part number."
Exit_Command21_Click:
Exit Sub
End Sub
I want a message to pop up to inform them that they will not get the desired results if they don't. I have created this error message, but when the form is tested, I can get it to display a message if they click the accept button except that the message is displayed before the subform closes and then again on the main form. If I select options as required to generate the number, I still receive the message. I cannot figure out what's going on with this.
Can anyone please help?
Private Sub Command21_Click()
'The error should check that a selection has been made in each option
If Me!QTB_CompItemID <> " " Then
Call BuildNumber
DoCmd.Close
Else
GoTo Error_CompItemID
Resume
End If
Error_CompItemID:
MsgBox "You must make a selection for each blank field on this form to generate the 25-digit part number."
Exit_Command21_Click:
Exit Sub
End Sub