A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Printing current record



 
 
Thread Tools Display Modes
  #1  
Old June 5th, 2004, 07:17 PM
David Cowdrey via AdminLife
external usenet poster
 
Posts: n/a
Default Printing current record

(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?
--------------------------------
From: David Cowdrey

-----------------------
Posted by a user from AdminLife (http://www.adminlife.com/)

IdFD7DH6lU9Em04KehHnHF2w==/Id
  #2  
Old June 5th, 2004, 09:01 PM
Albert D. Kallal
external usenet poster
 
Posts: n/a
Default Printing current record

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!

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada

http://www.attcanada.net/~kallal.msn


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:01 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.