Thanks for responding. Here is as much detail as I can think of:
Ok I am trying to include as much detail as possible. I have created a form
that holds a combo box, and a run query button. I want the combo box to
populate from a table and then whatever is in the combo box I want to be the
criteria for a query. Here are the steps I went through…
1. I have a table called Projects. In it there are 3 fields:
ID (auto primary key)
Project Number
Project Description
I want the combo box to display the project Number so I have set the column
widths for the combo box to 0â€,0â€, and 1.5â€
The Row Source Query that I typed is:
Select “All†From PROJECTS UNION Select Project Number From PROJECTS
I want the Project Number in the combo box to feed the query criteria below
but I also want to be able to let the user select “all†and have the query
just run with all the project numbers:
2. I have created a run query button on the form. In the run query button I
have the following VBA coded:
Private Sub Command4_Click()
On Error GoTo Err_Command4_Click
Dim stDocName As String
stDocName = "Project Query"
DoCmd.OpenReport stDocName, acPreview
Exit_Command4_Click:
Exit Sub
Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click
End Sub
3. In the Query I have the selection of the combo box (comboProjectList)
feeding it with the following as the criteria:
[forms]![testProjectform]![comboProjectList]
Obviously you can see I am a newbie. I know there should be an easy way to
run a query with a specific number as critieria or just to let it run w/out
criteria. I just cant get there! Thanks for your help.