Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd.RunMacro Problem/Question

Status
Not open for further replies.

cafulford

MIS
Oct 14, 2009
30
US
Hi, I am really new to VB and I have been tasked with modifying an existing Access application to basically print batches of bill of ladings.

I have the print working when I call the report directly like:

DoCmd.OpenReport "Bil OF Lading",, WhereCondition:=sWhere

but there is a macro as part of the original application that does a bunch of other required stuff when a bol prints beyond just printing and I have been trying to run that macro in replace of the DoCmd.OpenReport.

I have tried DoCmd.RunMacro "print_one_bl", WhereCondition:=sWhere but it does not like the WhereCondition clause. Is there any way to accomplish this?

Please see attached link for detail.


Thanks,

Charlie
 
I forgot to mention that I know the form is not open and that is problem #1 but also the WhereCondition:=sWhere does not work with the DoCmd.RunMacro command.

Ideas?
 
I have found out that the "print_one_bl" macro is not working because the form has to be open. That was where the print command was before in the old app. I also realized that the WhereCondition:=sWhere does not work with DoCmd.RunMacro.

So I guess I am asking: can I check for those conditions in the vb code that are now part of the macro?

1) make sure bl_num is not null before printing each record
2) check to see if there are enough records to print a page 2

I just do not even know how to tackle it. I am not a vb programmer.

Any help would be greatly appreciated!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top