Link to home
Start Free TrialLog in
Avatar of James Coats
James CoatsFlag for United States of America

asked on

Comand Buttions: Print Report options

I have a form inappropriately (I will change it) named: tbl_ComputerName1, I have a command button on it called: Print Microsoft Report, I want this button to print just the record that is on the page being viewed at present but it tries to print all the records. I also want to put another command button that will also print all the other records associated just with the one record (the other pages: tbl_ComputerName2, 3 ect.) being viewed from this page. I know this is a coding issue but I dont know how to start on this project
AssetTrack.mdb
Avatar of Lorenda Christensen
Lorenda Christensen
Flag of United States of America image

Can you show me the Query that your report is based on? You should be able to base your report on a query that pulls only the record shown on your form (assuming you have a primary key on your form somewhere).
ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SamuelClemmons,

Jim is correct.
Please get this part working first, and report back with the results

Then we can work on the "Other" button.

JeffCoachman
Avatar of James Coats

ASKER

Here is the code of my command button, how would you change to code to see an ID value? I do have PK with the tables.
Private Sub CommandMicrosoftSoftware_Click()
On Error GoTo Err_CommandMicrosoftSoftware_Click
 
    Dim stDocName As String
 
    stDocName = "rpt_MS_Software"
    DoCmd.OpenReport stDocName, acNormal
 
Exit_CommandMicrosoftSoftware_Click:
    Exit Sub
 
Err_CommandMicrosoftSoftware_Click:
    MsgBox Err.Description
    Resume Exit_CommandMicrosoftSoftware_Click
    
End Sub

Open in new window

SamuelClemmons,

Like I said, let's get the Report/Form Record synchronization working *first*, before anything else.

So, please apply jimhorn suggestion and get the crorrect data in the report working *first*.

Bedsides, with the correct record displayed on the report, I don't really see a need to "see an ID value"

JeffCoachman
Jim you got me started with the code sample on the ID. I solved the rest of it over the weekend