J
jutlaux
I have a form with a combo box on it where the user can select someone's name
and then hit a button to run a query that just shows records for the selected
person. That part works just fine, the problem I have is that sometimes you
want to see everyone and I am trying to make so that if the combo box is left
empty everyone is displayed, but if you don't select someone from the combo
box the report is empty when it runs.
Here is the what I have
Form -> "frmProgChangeLogSearch" with the following on it
Combo box ->"cboPlantEngineer", which does have the control source empty
Run query button -> "cmdSearchByName"
Query ->"qryChangeLogMain_Search"
In this query I have Field "strAssignedTo" that has the criteria
[Forms]![frmProgChangeLogSearch]![cboPlantEngineer]
The cmdSearchByName button code is:
Private Sub cmdSearchByName_Click()
On Error GoTo Err_cmdSearchByName_Click
Dim stDocName As String
stDocName = "qryChangeLogMain_Search"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_cmdSearchByName_Click:
Exit Sub
Err_cmdSearchByName_Click:
MsgBox Err.Description
Resume Exit_cmdSearchByName_Click
End Sub
Thanks
and then hit a button to run a query that just shows records for the selected
person. That part works just fine, the problem I have is that sometimes you
want to see everyone and I am trying to make so that if the combo box is left
empty everyone is displayed, but if you don't select someone from the combo
box the report is empty when it runs.
Here is the what I have
Form -> "frmProgChangeLogSearch" with the following on it
Combo box ->"cboPlantEngineer", which does have the control source empty
Run query button -> "cmdSearchByName"
Query ->"qryChangeLogMain_Search"
In this query I have Field "strAssignedTo" that has the criteria
[Forms]![frmProgChangeLogSearch]![cboPlantEngineer]
The cmdSearchByName button code is:
Private Sub cmdSearchByName_Click()
On Error GoTo Err_cmdSearchByName_Click
Dim stDocName As String
stDocName = "qryChangeLogMain_Search"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_cmdSearchByName_Click:
Exit Sub
Err_cmdSearchByName_Click:
MsgBox Err.Description
Resume Exit_cmdSearchByName_Click
End Sub
Thanks