Open report based on check box values

B

billybanter67

Hi I want to open up one report and be able to change the criteria I
open it with.

Dim stDocName As String
stDocName = "MonthlyDataALL"

'opens report based on just debtor
If Me.ChkDebtor = -1 And Me.chkEstimator = 0 And Me.ChkBrand = 0 Then
DoCmd.OpenReport stDocName, acPreview, , "Debtor= forms!DataDrill!
Debtor"
End If

That works fine, now if I want the values of 2 check boxes I would
have thought that this might work but it doesn't.

'opens report based on debtor and estimator

'If Me.ChkDebtor = -1 And Me.chkEstimator = -1 And Me.ChkBrand = 0
Then
' DoCmd.OpenReport stDocName, acPreview, , "Debtor= forms!DataDrill!
Debtor" and "Estimator= forms!DataDrill!Estimator"
'End If

Any guidance?


Thanks
 
B

billybanter67

I see what I did wrong


DoCmd.OpenReport stDocName, acPreview, , "Debtor= forms!DataDrill!
Debtor" and "Estimator= forms!DataDrill!Estimator"

should not have the " after debtor and before the estimator

DoCmd.OpenReport stDocName, acPreview, , "Debtor= forms!DataDrill!
Debtor and Estimator= forms!DataDrill!Estimator"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top