Results 1 to 6 of 6
  1. #1
    Lesg is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    101

    Print Report from Multiple Forms

    Hi Guys,

    I have a report the print a credit not that I want to use from 2 forms. in the query for the report and I added the 2 forms as selection criteria:

    Click image for larger version. 

Name:	report_print.JPG 
Views:	24 
Size:	20.9 KB 
ID:	48223

    the report works fine, however, I still get the parameter box for the form that it not being used to call the report. Can anyone advise how I can not show the parameter box?

    Regards


    Les

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    Use a tempvar as criteria and set that from each required form control.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Or maybe a convoluted IIF expression, such as
    IIF(IsNull(testA),testB,testA)

    where testA and testB are the form control references in this case?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    Lesg is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    101
    Can you expand on this suggestion please, i.e.is this via the query editor or in VBA code?

  5. #5
    xps35's Avatar
    xps35 is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jun 2022
    Location
    Schiedam, NL
    Posts
    229
    I don't think this is a good solution. If only one form is opened it won't work. That might be your problem. If both forms are opened you might end up with 2 notas (If both invoice numbers match).

    Remove the criterion from the query. Create a button on both forms to print the report and include a criterion.

    I also wonder why you need two forms when apparently it concerns the same data.

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Quote Originally Posted by Lesg View Post
    Can you expand on this suggestion please, i.e.is this via the query editor or in VBA code?
    That would be in the query design view using the same invoice field (or sql view if you prefer). I made the assumption that you know that both forms need to be open when you run the query.

    Usually one should not create multiple objects that do pretty much the same thing. If that is what you have done, it would be better to design 1 form/report to handle multiple situations. That might mean opening a form in one of the various modes (e.g. edit vs create new) based on user action, which is what your expression in the query suggests to me. Or it could mean using vba code to dynamically set a form record source property according to user choice. Could also involve showing/hiding various controls when opened. I'd say that the main reason for not duplicating such objects is that something about the underlying query changes (e.g. a field is added) then you have 2x as much work to do. It also makes the db larger than it needs to be.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. run a report multiple times and print them
    By chriswrcg in forum Macros
    Replies: 9
    Last Post: 01-04-2019, 05:04 PM
  2. Replies: 3
    Last Post: 10-15-2015, 08:48 PM
  3. Replies: 3
    Last Post: 02-04-2014, 04:33 PM
  4. Print report with multiple Tabs
    By diegoah in forum Reports
    Replies: 7
    Last Post: 02-03-2014, 08:20 AM
  5. Replies: 1
    Last Post: 03-16-2013, 09:20 PM

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