Problem with DoCmd.close acReport

vadharah

Registered User.
Local time
Today, 08:00
Joined
Oct 14, 2008
Messages
35
Hi guys

im having problems with the following code i open a report in vba then after doing some operations to it would like to close it and save it but having problems.


DoCmd.OpenReport "tester", acViewPreview, , StrWhere
........do something here......
DoCmd.Close acReport "tester", acSaveYes

the moment i specify the name of the report "tester" i get an error saying Complier error "expected end of statement" and the name is highlighted


any advice on where im going wrong
 
You're missing a comma before the report name.
 
Is it however possible to run a query then assign a value from the query or maybe a textbox to a filed on the report and then print...for instance

DoCmd.OpenReport "tester", acViewPreview, , StrWhere
Reports!tester!abc.Value = Forms!form1!test.Value
DoCmd.Close acReport, "tester", acSaveYes
asd = "Macro1"
DoCmd.RunMacro asd

where Macro1 prints the report?...

when i do this the text im adding does seem to be printed...

My idea to try and assign values to fileds on the report then print
 
Why not just give the abc textbox a control source of:

=Forms!form1!test
 

Users who are viewing this thread

Back
Top Bottom