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 » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Print current form only



 
 
Thread Tools Display Modes
  #1  
Old January 6th, 2005, 05:47 PM
tvh
external usenet poster
 
Posts: n/a
Default Print current form only

I've placed a "Print Invoice" command button on the bottom of a form, but
when I select the button, ALL of the invoices are printed. How can I just
print the current form that I'm working with?
Here's the current print procedu

***************************
Private Sub PrintInvoice_Click()
On Error GoTo Err_PrintInvoice_Click

Dim stDocName As String

stDocName = "Invoice"
DoCmd.OpenReport stDocName, acNormal

Exit_PrintInvoice_Click:
Exit Sub

Err_PrintInvoice_Click:
MsgBox Err.Description
Resume Exit_PrintInvoice_Click

End Sub
***************************
  #2  
Old January 6th, 2005, 06:14 PM
Paul Doree
external usenet poster
 
Posts: n/a
Default

Hi,

The following will do the job (it picks up your invoiceID from your form and
passes it to the report, printing only that record displaying on the
screen):


Dim strDocName As String
Dim strWhere As String
strDocName = "Invoice"
strWhere = "[InvoiceID]=" & Me!InvoiceID
DoCmd.OpenReport strDocName, acViewNormal, , strWhere



"tvh" wrote in message
...
I've placed a "Print Invoice" command button on the bottom of a form, but
when I select the button, ALL of the invoices are printed. How can I just
print the current form that I'm working with?
Here's the current print procedu

***************************
Private Sub PrintInvoice_Click()
On Error GoTo Err_PrintInvoice_Click

Dim stDocName As String

stDocName = "Invoice"
DoCmd.OpenReport stDocName, acNormal

Exit_PrintInvoice_Click:
Exit Sub

Err_PrintInvoice_Click:
MsgBox Err.Description
Resume Exit_PrintInvoice_Click

End Sub
***************************



  #3  
Old January 7th, 2005, 02:16 PM
Albert D. Kallal
external usenet poster
 
Posts: n/a
Default

"Paul Doree" wrote in message
...
Hi,

The following will do the job (it picks up your invoiceID from your form
and passes it to the report, printing only that record displaying on the
screen):


Dim strDocName As String
Dim strWhere As String
strDocName = "Invoice"
strWhere = "[InvoiceID]=" & Me!InvoiceID
DoCmd.OpenReport strDocName, acViewNormal, , strWhere


The above you have is 100%, however, if the user changes some data and hits
print, those changes
have NOT yet been saved, and will not appear in the invoice.

You nee add the following one line to force (write) the data to disk so the
report will see this data:

Dim strDocName As String
Dim strWhere As String

me.Refresh ---- add this line to force a disk write....
strDocName = "Invoice"
strWhere = "[InvoiceID]=" & Me!InvoiceID
DoCmd.OpenReport strDocName, acViewNormal, , strWhere




--
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
side fold card dep825 Publisher 5 December 7th, 2004 05:07 PM
How do I print the details view David Running & Setting Up Queries 5 August 28th, 2004 12:17 AM
auto entry into second table after update Tony New Users 13 July 9th, 2004 10:42 PM
Bug: print preview in form datasheet with server filter on crashes access (ADP A2002 SP3) Eric Cárdenas [MSFT] Using Forms 4 June 24th, 2004 08:38 AM
Recordset in subform based on field in parent form Lyn General Discussion 15 June 14th, 2004 03:10 PM


All times are GMT +1. The time now is 01:13 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.