Results 1 to 4 of 4
  1. #1
    _Boo is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    4

    Reports and variables, problems

    Hi so I am having a problem, I want to have my program, when the user hits generate to perform a query and them open up a separate report for each bladenumber in the query. The issue is that there is a subform in the report that I want to pass the bladenumber in order for it to requery and get results only with that number. My issue right now is that I don't know how to pass parameters to a report, and I don't know any other way to get the parameter to the subform. Any help would be awesome, thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    So 'generate' is a command button with code that opens the report? You should not have to 'run' the query, the query should be the RecordSource for the report. Isn't the subreport synchronized with the main report by the Master/Child properties? You can have the RecordSource reference the control on form to get the filter criteria (the form would have to remain open when the report opens). Or you can pass filter criteria to report with the WHERE clause of DoCmd.OpenReport.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    _Boo is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    4
    Ok I got it working by using global variables, my next problem is how to open the same report multiple times. It would be optimal if I could append them so that they all appear in one tab but as different records, but I dont think that is possible(at least at my level).
    Code:
       Dim rpt1 As Report
       Set rpt1 = New Report_rptBlueSheetNew
       rpt1.Visible = True
       rpt1.Filter = ""
       rpt1.FilterOn = True

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Global variable - would not have thought of that.

    No, cannot 'append' multiple reports into one output. You can set up so that each bladenumber record is on it own page and with report header/footer, each page can look like an independent report.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Using Public variables between forms/queries/reports
    By dcrake in forum Sample Databases
    Replies: 2
    Last Post: 12-25-2015, 05:44 PM
  2. Hyperlink Variables
    By CCW8 in forum Access
    Replies: 5
    Last Post: 07-08-2013, 06:20 PM
  3. VBA in variables
    By smikkelsen in forum Access
    Replies: 3
    Last Post: 11-12-2010, 03:14 PM
  4. Email Reports Problems
    By Bamber in forum Reports
    Replies: 1
    Last Post: 05-12-2010, 08:31 AM
  5. sql in vb variables
    By emilylu3 in forum Programming
    Replies: 3
    Last Post: 03-04-2006, 01:26 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