Print one record at a time (1 Viewer)

wgma

Registered User.
Local time
Yesterday, 21:58
Joined
Nov 19, 2007
Messages
72
I have been given the task of creating an application that will print invoices for a client.

They want to be able to enter in the info, save it, and then print just that invoice.

I have created the input screen and the invoice report. However, when I try to print the report I get a printout of all of the records in the database. This is not good. How can I fix this?

Thanks.
 

wgma

Registered User.
Local time
Yesterday, 21:58
Joined
Nov 19, 2007
Messages
72
Thanks for your response. I tried what you suggested but it did not work.

Private Sub cmdPrintBillOfLading_Click()
DoCmd.OpenReport "rptBillOfLading", acPreview, , "[ID]=" & Me!ID
End Sub

ID is the field in the table and Me!ID is from the form. The ID from the form is passed ok but I still get the first record in the table.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 19:58
Joined
Aug 30, 2003
Messages
36,139
What is the data type of ID in the table? Is the record saved at the point when the code runs?
 

wgma

Registered User.
Local time
Yesterday, 21:58
Joined
Nov 19, 2007
Messages
72
ID is an AutoNumber and yes the record is saved.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 19:58
Joined
Aug 30, 2003
Messages
36,139
Then that looks like it should work. Can you post a sample db?
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 19:58
Joined
Aug 30, 2003
Messages
36,139
If you go into the advanced reply area you'll see a Manage Attachments button. You can attach a sample db there (be sure to compact then zip to get under the size restriction).
 

wgma

Registered User.
Local time
Yesterday, 21:58
Joined
Nov 19, 2007
Messages
72
Here is the database.
 

Attachments

  • AyersMaritime.zip
    73.1 KB · Views: 100

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 19:58
Joined
Aug 30, 2003
Messages
36,139
That appears to be working as intended. If I'm on the first record and click the button, a 1 page report comes up with bill of lading ...005. If I go to the second record and click it, a 1-page report comes up with ...006. Am I misunderstanding the goal, or are you seeing different behavior?
 

wgma

Registered User.
Local time
Yesterday, 21:58
Joined
Nov 19, 2007
Messages
72
However, when I print the report I get both pages, 005 and 006. I only want to print the current page.
 

wgma

Registered User.
Local time
Yesterday, 21:58
Joined
Nov 19, 2007
Messages
72
I think that I have it working now. Thank you very much for your help.
 

wgma

Registered User.
Local time
Yesterday, 21:58
Joined
Nov 19, 2007
Messages
72
I have one more question since you have a copy of the db.

On the report you will notice that where ever there is dropdown on the form the report only prints the id of the item selected in the combo box. How do I get it to fill into the report the item from the combo box as well as the info below the combo box?
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 19:58
Joined
Aug 30, 2003
Messages
36,139
Rather than basing the report directly on the table, base it on a query that joins the main table to the lookup table(s), joined on the appropriate field(s). That will enable you to return the names and other data associated with the ID in the query, and thus include them in the report.
 

Users who are viewing this thread

Top Bottom