Printing current record

  • Thread starter David Cowdrey via AdminLife
  • Start date
D

David Cowdrey via AdminLife

(Type your message here)
Could someone please help!!

I am trying to print the current record on a form.
i have used the following code in the private sub for a preview report button in one instance:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenReport "NCR_Rpt", acViewPreview, , "[Serial Number]=" & Me.Serial_Number

and it works fine automatically.

I have tried to do exactly the same thing only changing the report name and corresponding fields on a different form
eg:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenReport "ECN_Rpt", acViewPreview, , "[ECN_ID]=" & Me.ECN_ID

when i click on the button it asks me for the ECN_ID and even if i just click ok it does what i want but
Does anyone know how to stop the prompt box from popping up or has anyone got a better code example?
 
A

Albert D. Kallal

Hum...looks ok.
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenReport "ECN_Rpt", acViewPreview, , "[ECN_ID]=" & Me.ECN_ID

The only thing to remember here is that [ECN_ID] is the name of the field in
the report..and has NOTHING to do with your current form.

So, I would check the report. The other thing to check is try launching the
report from the report tab..and NOT use code...does it still prompt? If it
does..then you likely have some control, or something else on the report
that needs to be looking at.

So, try launching the report from the report view tab..and see if any
prompts occur. if they do..then you have to fix.

And, then try your above code again. And, as mentoend, double check if the
field [ECN_ID] is in the reprot.


Good luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top