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

Controlling that a selection is made in a combo box

Status
Not open for further replies.

lartigue64

Technical User
Jan 3, 2008
16
FR
I have a form with a two combo boxes, one for the month and another for the year. Then there are several buttons that when clicked, will run a query based on the month and year selected in the combo boxes and then open the report that corresponds to the button. I'm trying to add a control so that if the button is clicked without selecting a value in the combo boxes, a message box tells the user they must first select the month and year.

I've tried

If Me.sel_Period.Value = Null Then
msgbox and other code here...
end if

but this doesn't work. What could be my problem?
 
What about

If Me.sel_Period = Null

Or

If Trim(Me.sel_Period & "")=<> Then

Or

If Me.sel_Period.Text = Null

It is often useful to move the focus before checking.
 
ok. i fixed it by setting the focus to the combo, then testing
If Me.sel_Period.Text = ""
thanks for your help!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top