?
Solved

Comand Buttions: Print Report options

Posted on 2008-06-13
6
Medium Priority
?
222 Views
Last Modified: 2013-11-28
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
0
Comment
Question by:James Coats
6 Comments
 
LVL 6

Expert Comment

by:lorenda
ID: 21781484
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).
0
 
LVL 66

Accepted Solution

by:
Jim Horn earned 1500 total points
ID: 21781528
Without looking at your attachment (sorry, personal rule) your command button should reference the primary key of the record currently active, and use the Filter parameter to filter (using the WHERE clause would work too) the report:

DoCmd.OpenReport "Your Report Name", acViewPreview, "[SomeIDValue]=" & Me.SomeIDValue
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 21781971
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
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 

Author Comment

by:James Coats
ID: 21783181
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

0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 21786804
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
0
 

Author Closing Comment

by:James Coats
ID: 31467024
Jim you got me started with the code sample on the ID. I solved the rest of it over the weekend
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question