Print Report

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Print Report

Post by D Willett »

Hi

I keep getting type Mismatch with the following code ( The bold section after "[Est No] = " & JN.
I think the 0 is a tect property.

Dim stDocName As String
Dim JN As String
JN = InputBox("Please Enter A Valid Job Number", "")
DoCmd.OpenReport "Fleet Referral", acViewNormal, , "[Est No] = " & JN And "[Supp] = '0'"
Cheers ...

Dave.

User avatar
HansV
Administrator
Posts: 78531
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Print Report

Post by HansV »

Hi Dave, the quotes are not quite correct.

If Supp is a text field:

DoCmd.OpenReport "Fleet Referral", acViewNormal, , "[Est No] = " & JN & " And [Supp] = '0'"

If it is a number field:

DoCmd.OpenReport "Fleet Referral", acViewNormal, , "[Est No] = " & JN & " And [Supp] = 0"
Best wishes,
Hans

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Re: Print Report

Post by D Willett »

Hi Hans

I knew it was the quotes, they're confusing.
It was a number field and works fine.

Thanks again.
Cheers ...

Dave.