yet an other newbee... (syntax question)

gussi

New member
Local time
Today, 23:37
Joined
Sep 5, 2006
Messages
6
Hi, I am trying to create a report from vba with a condition.

So far I have tried:

Dim IntCompanyCode As Integer
DoCmd.OpenReport "Invoice", acViewPreview, , Inv_Nr = 15

and:

IntCompanyCode = 15

DoCmd.OpenReport "Invoice", acViewPreview
Invoice.Filter = "((Inv_Nr) = " & IntCompanyCode & " )"
Invoice.FilterOn = True
Invoice.Text1.Visible = False
'DoCmd.Close acReport, "rptPage1", acSaveYes

The report is built on a query where Inv_Nr is one of the fields formated as text

I know this is probably a pretty stupid question, but please help me anyway.

G
 
DoCmd.OpenReport "Invoice", acViewPreview, , "[Inv_Nr] = 15"

Hope this helps?
 
thanks,

I just did
'set company number
strCompanyCode = "'15'"

'Open Filtered report
DoCmd.OpenReport "Invoice", acViewPreview, , "Inv_CCE = " & strCompanyCode
and it worked also.


GREAT

/G
 

Users who are viewing this thread

Back
Top Bottom