tags:

views:

100

answers:

2

hi

I just migrated to ms access 2007 and created my own ribbon. In my form, I have this "print" button where if you click that it will open the "report form"

here is what I wrote in my VBA code:

Case "btnPrintRevisionEingabe"
DoCmd.OpenReport acReport, "Revision_Eingabe_rpt", acSaveNo

and when I clicked on the "print" button

I'm getting an error "type mismatch runtime error 13"....

Please help.. Thanks

+1  A: 

My original answer was wrong, see the answer from astander which is the correct one.

Shiraz Bhaiji
@Shiraz Bhaiji: I tried this but now I'm getting a different error it says: "Run Time error 2505 An expression in argument 2 has an invalid value"
tintincute
+3  A: 

Try just the following

docmd.OpenReport "Revision_Eingabe_rpt", acViewReport

nothing after that. Leave out the acSaveNo. That should work.

astander
@astander: thanks it works. How can I have it in Print Preview? Because when I clicked on the "Print" button it open the document but in a normal view, how can i open it in print preview? Thanks
tintincute
Change **acViewReport** to **acViewPreview**
astander
@astander: alright, that works now. Thanks a lot :-)
tintincute
@tintincute So how about changing the accepted answer to this one?
Remou
@Remou: what do you mean? you mean your answer?
tintincute