psbrown
MIS
- Oct 16, 2001
- 40
Hi
I have found in this forum on how to use a combo box on a form to provide criteria for a query. I have tried to get this to work for more hours that I care to think about without success, the query just comes up blank.
The senario is this.
Form frmMASRSummary has a combo box cboWeekNo that gets its values from table SafetyIncidentMaster. A command button has the following code calls the query.
Private Sub CmdRprOpen_Click()
On Error GoTo Err_CmdRprOpen_Click
Dim stDocName As String
DoCmd.OpenQuery "qryMASRSummary"
Exit_CmdRprOpen_Click:
Exit Sub
Err_CmdRprOpen_Click:
MsgBox Err.Description
Resume Exit_CmdRprOpen_Click
End Sub
I have a query qryMASRSummary that gets data from table SafetyIncidentMaster and the following criteria on the weekno field. [forms]![frmMASRSummary]![cboWeekNo].
If I remove the criteria and put ["value?] in as the criteria it runs and asks me for a value which I type in and it works ok
The mechanism seems to be working because it invokes the query when i press the command button, I suspect that there is somthing else wrong and would appreciate any advice.
Thanks
Paul
I have found in this forum on how to use a combo box on a form to provide criteria for a query. I have tried to get this to work for more hours that I care to think about without success, the query just comes up blank.
The senario is this.
Form frmMASRSummary has a combo box cboWeekNo that gets its values from table SafetyIncidentMaster. A command button has the following code calls the query.
Private Sub CmdRprOpen_Click()
On Error GoTo Err_CmdRprOpen_Click
Dim stDocName As String
DoCmd.OpenQuery "qryMASRSummary"
Exit_CmdRprOpen_Click:
Exit Sub
Err_CmdRprOpen_Click:
MsgBox Err.Description
Resume Exit_CmdRprOpen_Click
End Sub
I have a query qryMASRSummary that gets data from table SafetyIncidentMaster and the following criteria on the weekno field. [forms]![frmMASRSummary]![cboWeekNo].
If I remove the criteria and put ["value?] in as the criteria it runs and asks me for a value which I type in and it works ok
The mechanism seems to be working because it invokes the query when i press the command button, I suspect that there is somthing else wrong and would appreciate any advice.
Thanks
Paul