I would like some help with a Combo Box issue. I have two forms, each with a Combo Box, that allows the user to select a client, either by AlienNumber (form1 or by LastName (form 2). I have a “Continue” button on each form that results in the opening a form that is data sourced to a select query where the criteria for the selection is based on the selection made in the Combo Box opn the previous form. If I simply code the Continue button to open the proper form (DoCmd.OpenForm "SpecificClientSelectedByNameFrm", acNormal, "", "", , acNormal) and I have not made a selection in the Combo Box the second form (SpecificClientSelectedByNameFrm) opens but it is empty. If I type in a name that is not on the Combo Box list and select the “Continue” button I get an error message that reads “The text you entered isn’t an item on the list”.
On the other hand, if I attach code to the “Continue” button to advise the user if they have not made a selection from the Combo Box (in other words the Combo Box is left blank) I can successfully place an error message to the user asking them to make a selection from the list. However, if they have typed in something into the Combo Box that is not on the list the proper form opens but it is empty.
The code I use to inform the client that they have not made a selection is:
If Combo1.Value & "" = "" Then
MsgBox "You have not selected a Client. Use the DropDown list to the right of the Alien Number box to select the Client you wish see.", vbOKOnly, ""
Else
DoCmd.OpenForm "SpecificClientSeletedFrm", acNormal, "", "", , acNormal
End If
I want the code to check for no selection on the Combo Box but I also want to inform the user if they have entered data that is not on the list but what I have so far will only do one or the other but not both. The OpenForm statement is the same on each:
DoCmd.OpenForm "SpecificClientSelectedByNameFrm", acNormal, "", "", , acNormal
DoCmd.OpenForm "SpecificClientSeletedFrm", acNormal, "", "", , acNormal
The only difference is that one has an if than else clause before the OpenForm code and the other doesn’t.
Any ideas?
Thanks in advance for the help.
Ron