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 » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Inserting a value into a report triggered by a select query



 
 
Thread Tools Display Modes
  #1  
Old November 16th, 2005, 09:25 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Inserting a value into a report triggered by a select query

I have created a form which generates an invoice number. I have also created
an invoice (report) which is based on the values in this form. The report is
based on a query which prompts for invoice number. Thus when the user prints
the invoice based on the data in the current screen, they are prompted to
enter the invoice number (a duplication of effort). What I would like to do
is code the form to pass the current invoice number to the query which powers
the report (invoice). I have tried to code this in the On Click command button

Private Sub Preview_Invoice_Click()
On Error GoTo Err_Preview_Invoice_Click
If Not IsNull(Me![InvoiceID]) Then
Invoice![InvoiceID] = Me![InvoiceID]
DoCmd.OpenReport "Invoice", acPreview
Exit_Preview_Invoice_Click:
Exit Sub
Err_Preview_Invoice_Click:
MsgBox Err.Description
Resume Exit_Preview_Invoice_Click
End Sub

However, I can not get the invoice date to pass into the invoice report. Am
I off with the command passing the invoice number to the invoice report
(should that code come after the DoCmd code?) Is it because I am passing the
invoice number to the report, rather than the query? Please advise.
--
Robert Robinson
  #2  
Old November 19th, 2005, 02:18 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Inserting a value into a report triggered by a select query

Robert:

You can directly reference the InvoiceID control in your form in the query
behind the report. This is generally referred to as the "Query By Form"
technique. The following KB article gives more information.

http://support.microsoft.com/default...b;en-us;304428

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


"Robert Robinson" wrote in
message ...
I have created a form which generates an invoice number. I have also created
an invoice (report) which is based on the values in this form. The report is
based on a query which prompts for invoice number. Thus when the user prints
the invoice based on the data in the current screen, they are prompted to
enter the invoice number (a duplication of effort). What I would like to do
is code the form to pass the current invoice number to the query which
powers
the report (invoice). I have tried to code this in the On Click command
button

Private Sub Preview_Invoice_Click()
On Error GoTo Err_Preview_Invoice_Click
If Not IsNull(Me![InvoiceID]) Then
Invoice![InvoiceID] = Me![InvoiceID]
DoCmd.OpenReport "Invoice", acPreview
Exit_Preview_Invoice_Click:
Exit Sub
Err_Preview_Invoice_Click:
MsgBox Err.Description
Resume Exit_Preview_Invoice_Click
End Sub

However, I can not get the invoice date to pass into the invoice report. Am
I off with the command passing the invoice number to the invoice report
(should that code come after the DoCmd code?) Is it because I am passing the
invoice number to the report, rather than the query? Please advise.
--
Robert Robinson


 




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
Error when running Query, but not Report Blaze Running & Setting Up Queries 29 September 9th, 2005 05:40 AM
To Sharkbyte and all: Calculate a total values in group level Ally General Discussion 6 June 13th, 2005 08:16 PM
Big number gives error! Sara Mellen Running & Setting Up Queries 8 October 11th, 2004 02:48 AM
Print Taher Setting Up & Running Reports 1 August 31st, 2004 09:07 PM
Display Parameter from Form on Report sara Setting Up & Running Reports 10 July 19th, 2004 04:54 PM


All times are GMT +1. The time now is 10:42 AM.


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