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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Getting information From Form to report
Hey all,
i have designed an invoice as a form but inorder for me to print out a professional invoice i want it to print from a report. I want to take information from the form to the report so i can produce a professional invoice. How would i go about doing this? I have tried using the expression builder and taking fields from the form but i end up with errors such as '#name?' in teh fields i want. All help would be smashing |
#2
|
|||
|
|||
Getting information From Form to report
Are you saving all the data in a table? If so, just ask the user which invoice to print, and the print it. Use a prompt in your query.
If you have a form and you want to add a button to print only that particular invoice, use code similar to the following... Button to print specific record Private Sub cmdPrint_Click() Dim strWhere As String If Me.Dirty Then 'Save any edits. Me.Dirty = False End If If Me.NewRecord Then 'Check there is a record to print MsgBox "Select a record to print" Else strWhere = "[ID] = " & Me.[ID] DoCmd.OpenReport "MyReport", acViewPreview, , strWhere End If End Sub Notes: If your primary key is a Text type field (not a Number type field), you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """" If you want the report to print without preview, replace acViewPreview with acViewNormal. See also: http://allenbrowne.com/casu-15.html -- Rick B wrote in message oups.com... Hey all, i have designed an invoice as a form but inorder for me to print out a professional invoice i want it to print from a report. I want to take information from the form to the report so i can produce a professional invoice. How would i go about doing this? I have tried using the expression builder and taking fields from the form but i end up with errors such as '#name?' in teh fields i want. All help would be smashing |
#3
|
|||
|
|||
Getting information From Form to report
Thanks for the info rick, the info was great but i can print from the
invoice in form view but i want to design a report so my invoice looks better, for example add a logo, look up customer details from their id and print this on top of the invoice. How would i transfer information from the invoice form to a report(invoice). I am not saving all my information from the form to my invoice and invoice details table. I work out calculations such as subtotal, total before tax and others through the form.(i can work these calculatiosn again from using these in the report right? ) All help would be great have a nice day |
#4
|
|||
|
|||
Getting information From Form to report
wrote in message oups.com... Thanks for the info rick, the info was great but i can print from the invoice in form view but i want to design a report so my invoice looks better, for example add a logo, look up customer details from their id and print this on top of the invoice. How would i transfer information from the invoice form to a report(invoice). I am not saving all my information from the form to my invoice and invoice details table. I work out calculations such as subtotal, total before tax and others through the form.(i can work these calculatiosn again from using these in the report right? ) All help would be great Obviously, you have the calculations in the Form. Copy and paste them into the Report, modify as necessary. Reports are "driven" by data from their RecordSource, which will be a reference to a Query, an SQL Statement, or a Table. Transferring data from an _open_ Form is possible, but it is better to include the same/similar calculations in the Report. Use the Form's identifier for the invoice ID to be printed... assuming you use a DoCmd.OpenReport in the Click event code of a Command Button on the Form, check help on the WhereCondition argument of DoCmd.OpenReport. Larry Linson Microsoft Access MVP |
Thread Tools | |
Display Modes | |
|
|