Create Print Button To Print Only One Record

WES9659

Registered User.
Local time
Today, 08:04
Joined
Dec 17, 2012
Messages
17
This may seem like a silly question and I may not have all the technical names down so please bear with me. I have created an access 2010 database. From which my main data is store in the table named Primary_Data_Table my main table key is an auto key named ClientId. I than created 4 reports from which I would like to create a button to print only one client record at a time from. I would like to link all four reports to print out at same time and to be only current record that I have populated through my Navigation Form. The four reports are named:
ClientReportPage1
ClientReportPage2
ClientReportPage3
ClientReportPage4


Thanks everyone for all your help in advance and forgive me for my novice abilities.

I do well with step by step instructions
Thank You
Bill
 

AccessMSSQL

Seasoned Programmer-ette
Local time
Today, 06:04
Joined
May 3, 2012
Messages
636
You need to use the Docmd.OpenReport function and pass a WHERE argument in:
Code:
Private Sub YourButton_Click()
DoCmd.OpenReport "[B]ClientReportPage1[/B]", acViewNormal, , "ClientID=" & ClientID
end sub

Create the same statement for each report.

This needs to go behind your button_Click event procedure
 

WES9659

Registered User.
Local time
Today, 08:04
Joined
Dec 17, 2012
Messages
17
Hi Cheryl,

Thank you so much for your response, however, I feel really ignorant can you tell me where or how I would get to the Docmd.OpenReport function so I can put in the Where statement. Do I do it as a Macro? Thank you so much for your help.


Bill
 

AccessMSSQL

Seasoned Programmer-ette
Local time
Today, 06:04
Joined
May 3, 2012
Messages
636
Hi Bill:
I looked at your DB and here are some screenshots of how to get to the vba window and put in the code you need.
1. Open your navigation form in design view and go to the Print button properties.
2. Find the OnClick event procedure
3. Delete the embedded macro from the onclick property
4. Choose Event Procedure in the OnClick property of the button.
5. Click the elipses next to the event procedure property.
6. You will be taken to the Click event of your print button.

Screenshots attached!

I've put the code in that you need.
 

Attachments

  • ButtonOnClick1.jpg
    ButtonOnClick1.jpg
    38.9 KB · Views: 1,263
  • buttonOnclick2_deleteembeddedmacro.jpg
    buttonOnclick2_deleteembeddedmacro.jpg
    32.4 KB · Views: 1,122
  • OnClick_ChooseEventProcedure.jpg
    OnClick_ChooseEventProcedure.jpg
    38.8 KB · Views: 1,152
  • ChooseElpises.jpg
    ChooseElpises.jpg
    46.8 KB · Views: 1,173
  • VBACodeWindow.jpg
    VBACodeWindow.jpg
    63.2 KB · Views: 1,421
Last edited:

Users who are viewing this thread

Top Bottom