How can I ensure data is selected from a combo box?

rnickels

Registered User.
Local time
Today, 06:35
Joined
Dec 8, 2006
Messages
48
Can someone please help me?

I have a combo box on a form that the user can select a player name.
Under the combo box I have a label called "Show me information about selected Player: that once clicked takes the user to another form which has all information about the player that was previously selected in the combo box.

Everything works fine UNLESS the user forgets to select a playername from the combo box and clicks on the label anyway. Obviously no player name was selected so a blank form opens which is a problem!

How can I ensure that a player name is selected and prevent the user from clicking on the label below without having previously selecting from the combo box?

If anyone can please help I would appreciate it so much.

Rob
 
Are you just looking up data or adding data as well
 
Rob

I am just looking up data
 
In the code on the label's click event that opens the form:
Code:
If IsNull(Me.YourComboBoxNameHere) Then
   MsgBox "You have to select something before opening the form!",vbOKOnly,"Selection Error"
   Exit Sub
End If
 

Users who are viewing this thread

Back
Top Bottom