Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Comand Buttions: Print Report options

Posted on 2008-06-13
6
Medium Priority
?
209 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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…

704 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