Solved

Comand Buttions: Print Report options

Posted on 2008-06-13
6
190 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 65

Accepted Solution

by:
Jim Horn earned 500 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now