J
johng
I’ve created a form for passing parameters for a report whose record source is a query with no criteria;
as you see, I’m using DoCmd with a ‘where’ portion to pass the criteria parameters –
The date parm is from a text box, the Campaigns are form a multiselect List box with code to create a string and make it the value of another text box ….
Result is: I’m prompted for each parameter, and if I just click OK – no records are retrieved; If I enter the parameters (the ones I’ve put in my ‘Where’) I’m returned ALL records – the ‘where’ clause is ignored ….. ?!?!?!?!
My procedure in the form :
Public Sub cmndCapCampAlpha_Click()
On Error GoTo Err_cmndCapCampAlpha_Click
Dim stDocName As String
Dim strWhere As String
strWhere = " dbo_T_CONTRIBUTION.cont.dt <= #" & Me![AsOfDate] & "#" _
& " AND dbo_T_CONTRIBUTION.campaign_no IN(" & Me!txtCampaigns & ")"
Debug.Print strWhere
stDocName = "rptCapitalCampaigns_alpha"
DoCmd.OpenReport stDocName, acPreview, , strWhere
Exit_cmndCapCampAlpha_Click:
Exit Sub
Err_cmndCapCampAlpha_Click:
MsgBox Err.Description
Resume Exit_cmndCapCampAlpha_Click
End Sub
The immediate window display after the ‘debug.print’ (above):
dbo_T_CONTRIBUTION.cont.dt <= #7/16/2004# AND dbo_T_CONTRIBUTION.campaign_no IN(377,175)
the above is exactly what I want to have as criteria ………
any suggestions ?!
as you see, I’m using DoCmd with a ‘where’ portion to pass the criteria parameters –
The date parm is from a text box, the Campaigns are form a multiselect List box with code to create a string and make it the value of another text box ….
Result is: I’m prompted for each parameter, and if I just click OK – no records are retrieved; If I enter the parameters (the ones I’ve put in my ‘Where’) I’m returned ALL records – the ‘where’ clause is ignored ….. ?!?!?!?!
My procedure in the form :
Public Sub cmndCapCampAlpha_Click()
On Error GoTo Err_cmndCapCampAlpha_Click
Dim stDocName As String
Dim strWhere As String
strWhere = " dbo_T_CONTRIBUTION.cont.dt <= #" & Me![AsOfDate] & "#" _
& " AND dbo_T_CONTRIBUTION.campaign_no IN(" & Me!txtCampaigns & ")"
Debug.Print strWhere
stDocName = "rptCapitalCampaigns_alpha"
DoCmd.OpenReport stDocName, acPreview, , strWhere
Exit_cmndCapCampAlpha_Click:
Exit Sub
Err_cmndCapCampAlpha_Click:
MsgBox Err.Description
Resume Exit_cmndCapCampAlpha_Click
End Sub
The immediate window display after the ‘debug.print’ (above):
dbo_T_CONTRIBUTION.cont.dt <= #7/16/2004# AND dbo_T_CONTRIBUTION.campaign_no IN(377,175)
the above is exactly what I want to have as criteria ………
any suggestions ?!