Solved

Comand Buttions: Print Report options

Posted on 2008-06-13
6
194 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

867 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

21 Experts available now in Live!

Get 1:1 Help Now