Results 1 to 14 of 14
  1. #1
    Ryanm0085 is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Feb 2015
    Posts
    22

    Print Report for Single Record

    Hello. I am the president of a volunteer fire company and very new to access. I was able to create a table to record information for our fire calls. I was then able to develop a simple form that our members use to add new records to the table. Its very simple. After a call, the officer will go through and fill out the Fire Call Form, which then updates the Fire Call Table.



    I need to be able to print a report for individual calls. We had an insurance company request a copy of the call information to be submitted. I created a Report layout, but have no way to choose a single event from the table. Right now, the report wants to print every incident. The primary key is a case number which is always unique.

    I would like to be able to enter in a case number and print just the report for that record. Again, i have very little experience with access. I have a table and a form, that is it. Any help would be great!

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    This depends a lot on your dB design.

    One method would be to use a form with a combo box to select the case number and a button to print the report.

    Do you ever have to print multiple cases? If yes, then I might use a multi-select list box instead of the combo box and loop through the list box to print the reports.

  3. #3
    Ryanm0085 is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Feb 2015
    Posts
    22
    at some point we might need to print more than 1. i was just hoping to be able to print 1 for now. right now all i have is a form that enters the info into the table. Would i need to create a seperate form with a combo box to print the report?

  4. #4
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    No, minimize forms creation as much as practical (note I didn't say possible); i.e. reuse wherever possible. Add a button to your form to open the report, and do one of 3 things I can think of at the moment.
    1) apply a filter to the report opening sequence so as to limit the records on the report to the one that matches the unique id. That filter can be a stored query that gets the id parameter from your form control that contains it (such as putting Forms!frmMyFormName.myControlName in the same query design field that the form control is based on). This requires that the form be open whenever the query is run.

    2) applying the filter property of the OpenReport method of the DoCmd object (there are a gazillion web pages on how to do this - here's one, which just happens to mention my third option as well) http://www.blueclaw-db.com/docmd_openreport.htm
    DoCmd.OpenReport(ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs)

    3) use the OpenArgs property to pass the id to the report Load event and filter the report (in report based code) based on the argument value that is passed.

    I would lean towards #2. The report record source would likely be the same as how you're loading the form, but the filter would restrict the records. As long as there aren't a half-million records behind the report, you shouldn't notice any difference in speed using one method over the other. If you're doing this on a combo box and only want a single record report for now, that's about it. Otherwise, your combo will require some tweaking to provide a "one" versus "all" choice. Then there is the listbox option as mentioned, but I'm not a huge fan of multi-select listboxes. I prefer to manipulate choices using two lists; "from" and "to", and work off of everything that has been put into the "to" list. That's another discussion.
    Last edited by Micron; 04-24-2017 at 08:08 PM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    No, you need some way to identify the unique case number - type it in a text box, select it from a combo box or list box.
    The code behind the button would be something like:

    If the unique case number field type is a number
    Code:
    Dim sWhere as string
    
    sWhere = "CaseNumber = " & tbCaseNum
    DoCmd.OpenReport("MyReportName", , , sWhere)

    If the unique case number field type is text
    Code:
    Dim sWhere as string
    
    sWhere = "CaseNumber = '" & tbCaseNum & "'"
    DoCmd.OpenReport("MyReportName", , , sWhere)
    Note: in this example tbCaseNum is a text box you enter the case number into.
    "MyReportName" is the name of your report

  6. #6
    Join Date
    May 2010
    Posts
    339
    Maybe this will help. http://allenbrowne.com/casu-15.html

  7. #7
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Here is a small db that I developed several years ago that does what you are looking for. You can reverse engineer this to meet your specific neeeds.
    Attached Files Attached Files

  8. #8
    Ryanm0085 is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Feb 2015
    Posts
    22
    ssanfu...i copied exactly what you had. i changed the combo box name to tbCaseNum to make it easier, and changed in the code the myreport to Test, which it is called. However nothing happens when i choose the case number and then push the button. I appreciate the help. I am very new to this so i could be missing something simple.

  9. #9
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Can you post your dB?

  10. #10
    Ryanm0085 is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Feb 2015
    Posts
    22
    i have zipped the database, but every time i try to upload it, it fails for some reason. any ideas? its only 3.9mb

  11. #11
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    First do a "Compact and Repair", then zip the dB.
    The max zip upload size is 2mb......

    Otherwise, you will need to use something like dropbox......

  12. #12
    Ryanm0085 is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Feb 2015
    Posts
    22
    i cannot get it smaller than 3 mb unfortunately.

  13. #13
    Ryanm0085 is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Feb 2015
    Posts
    22
    would it be possible to email it to you?

  14. #14
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Have you looked at my example db in post #7?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Print single record in report and view
    By banpreet in forum Reports
    Replies: 3
    Last Post: 01-12-2017, 02:38 PM
  2. Search and Print Single Record in a Report
    By Candy_Tech in forum Reports
    Replies: 2
    Last Post: 01-12-2017, 01:20 PM
  3. Print out single record onto a report
    By CQCDave in forum Access
    Replies: 2
    Last Post: 04-23-2015, 06:54 AM
  4. Print out single record onto a report
    By CQCDave in forum Access
    Replies: 14
    Last Post: 01-08-2015, 12:55 PM
  5. How to print a single Record's report?
    By yes sir in forum Access
    Replies: 7
    Last Post: 09-20-2010, 07:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums