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

Using Combo box to set criteria for query results in blank

Status
Not open for further replies.

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


 
Fixed it

Simple error of not having the correct coloumn bound in the combo box, in the words of Homer DOH!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top