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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combo box error - allows " " as an entry

Status
Not open for further replies.

etislost

Technical User
Nov 23, 2003
19
0
0
US
I have three comboboxes. Box 1 determines whether 2 and 3 are visible using the following code:

Private Sub Combo001_Click()
Select Case Me.Combo001
Case "Lewisville Lake"
Me.Combo002.Visible = True
Me.Combo003.Visible = False
Case "Grapevine Lake"
Me.Combo002.Visible = False
Me.Combo003.Visible = True
Case Else
Me.Combo002.Visible = False
Me.Combo003.Visible = False
End Select

End Sub


For whatever reason, combo002 shows up whether you have clicked on combo001 or not, allowing the user to create an entry such that combo001 records " " and combo002 records one of three listed choices.


My question, finally, is this...How do you set up the code or whatever else so that having " " as an entry in combo001 will deny the user the opportunity to store/save the record? Also, why can I still see either combo002 or combo003 if I haven't made an entry in combo001? How do I rewrite the code or make a change such that neither combo002 or combo003 is visible until combo001 has a viable entry in it?

Struggling as a beginner :(

Steve P.
 
The way I do this is:

Make sure a default value IS displayed in cmb001, this then ensures a default value in cmb2, and hence cmb3.

Logically, you want to display a combo with no value - however, it DOES have values in it's list. Why display nothing as default? It implies that the combo has no values.

Combo2 MUST have a query that pulls values back dependant on the primary key of combo1, if not, combo2 will always pull everything back and display first item in list.

ATB

Darrylle



"Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
I was with you til that last paragraph. Sadly, I don't know how to do that. Please elaborate.

Thanks,
Steve P.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top