Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reports based on forms

Status
Not open for further replies.

kettch

Programmer
Mar 5, 2001
110
US
Does anyone know how to make a report based on the current information visible in a form? For instance, if i had an invoice form, and i entered in all the appropriate information, and then i wanted to print out and invoice, i would want to create a report that is based on the current data in the form. What would i need to do in order to do that?

I also want to thank everyone here for all of your help on other stuff, you've been great. :)
 
In the rrecord source property of the report use the query builder and as criteria for (in you example) InvoiceId put [Forms!].[YourForm].Form.[Id object name].

-I always forget the exact syntax usung brackets but access usually corrects them for you
 
To expand a little on what Doug is saying, you need to have a report that has the same data source as your form. Then on your command button, you can specify a filter that limits the number of records that are displayed in the report (allowing you to print a single invoice)

Dim stDocName As String

stDocName = "invoice"
DoCmd.OpenReport stDocName, acPreview, , "[invoicenumber] = " & Me.invoicenumber Mike Rohde
rohdem@marshallengines.com
 
i can get as far as making the query run right. However, i am still stuck on making the command button get the right data. I'm sorry, but i forgot to mention earlier that the "invoiceid" is in a subform. I am not sure of the proper syntax to put there instead of Me.invoicenumber

stDocName = "invoice"
DoCmd.OpenReport stDocName, acPreview, , "[invoicenumber] = " & Me.(????????????)
 
What happens when you click the command button is that a dialog box pops up and asks you for the invoice number even though the code Rohdem gave me specifically asks for Me.invoicenumber.
 
Try
[subformname].[Form]![invoiceid] Mike Rohde
rohdem@marshallengines.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top