DoCmd

mike60smart

Registered User.
Local time
Today, 13:44
Joined
Aug 6, 2017
Messages
2,177
Hi Everyone

Can anyone tell me where I am going wrong with the Syntax in the following DoCmd?

Code:
DoCmd.OpenReport "rptCurrentSale", acPreview, , "[ContractID]=" & Me.ContractID And "[sellerID] = " & Me.txtSellerID

Any help appreciated
 
"[ContractID]=" & Me.ContractID " And [sellerID] = " & Me.txtSellerID

Assuming numeric
 
Hi MajP

I get the following error when I try that?

Error.PNG
 
Code:
DoCmd.OpenReport "rptCurrentSale", acPreview, , "[ContractID]=" & Me.ContractID  & " And  [sellerID] = " & Me.txtSellerID

FWIW I tend to put filter/where criteria into a string and then use that.?

That way I can debug.print it.

HTH
 
Hi MajP

Thanks for looking but I have found a solution using this:-

Code:
DoCmd.OpenReport "rptCurrentSale", acPreview, , "[ContractID]= Forms![Create Contract]![ContractID] And [sellerID] = Forms![Create Contract]![txtSellerID]"

Thanks again
:)
 
Forgot the ampersand
"[ContractID]=" & Me.ContractID & " And [sellerID] = " & Me.txtSellerID
 

Users who are viewing this thread

Back
Top Bottom