pam said:
I have a combo box, but I need the user to select a value in that
combo box which will then open a report with only the data from the
value the user selected in the combo box.
Is it a form or a report that you want to open? You said "form" before,
but "report" now. I'll assume it's a report.
I'll also assume that the combo box and the command button are on the
same form. I'll call the combo "cboLocation", the button "cmdReport",
and the report to be opened, "rptMyReport". I'll assume that the
Location field is a text field.
If you want to require that the user have chosen a location before
clicking the button to open the report, you could have code for the
button's Click event procedure like this:
'----- start of example code -----
Private Sub cmdReport_Click()
If IsNull(Me.cboLocation) Then
MsgBox "Please choose a location first!"
Else
DoCmd.OpenReport "rptMyReport", _
WhereCondition:="Location = '" & Me.cboLocation & "'"
End If
End Sub
'----- end of example code -----
Note: that also assumes that the Location field won't contain the
single-quote character (').