Results 1 to 11 of 11
  1. #1
    argsemapp is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    18

    Using a form in a report

    Access newbie


    I have a form that queries info from my database. I have several report formats that need to use this form to populate the report.

    General question:
    How do I pass values from my form to my report?
    How do I plunk a form into my report and get it to work like it works in the Form Sheet? Dragging and dropping creates a clunky window-in-window.
    How do I handle the loop to populate the report (i.e. I'll be looping that form n-times to get n-entries on my report)?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Open report with the same RecordSource and apply same filter criteria. Usual practice is to have unbound controls on a form for user input of filter parameters. Reference those controls. Options:

    1. http://datapigtechnologies.com/flash...mtoreport.html

    2. use WHERE CONDITION of DoCmd.OpenReport. Access VBA Help has more info.

    I have never used a form within a report (I have done the opposite). I don't think it will work nicely.

    Why would you 'loop to populate'?
    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
    argsemapp is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    18
    June-

    Thank you for the great reference!

    I am looping because the report will have x number of entries (as many as the user needs). What is the best way of handling "filling out report over and over" to get x-entries on my report?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    You want the same data repeated or you want to fill with blank rows?

    One way is to save duplicate (and/or empty) records to a temp table.

    Another way is to force the report to repeatedly render the last record. http://www.tek-tips.com/viewthread.cfm?qid=1695691
    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.

  5. #5
    argsemapp is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    18
    I have a form with a combobox populated by a query, and a manual input for LotNumber. On_Enter() of this combobox I would like to print the data (along with some cross-referenced data) onto a report. There will be several entries to cross-reference/print for this report.

    The DoCmd.OpenReport opened a report, but I can't input any data in my form while the report is open like this.

    Could you please suggest a better way of creating a report like this perhaps?

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    First of all, I don't think you want the OnEnter event of combobox, use AfterUpdate.

    Second, I am not sure what you mean by 'manual input' and 'cross-referenced'. Is this LotNumber entered into unbound combobox and is used to filter the report? By 'cross-referenced' do you mean related tables?

    Why would you enter data on form after report is rendered?
    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.

  7. #7
    argsemapp is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    18
    June7-

    You got it, LotNumber is an unbound textbox, but is not used to filter the report (yet). And by cross-reference I mean pulling fields from a related table, yes.

    I'm trying to find a way to have multiple entries for my report. Can you suggest any best practices for this operation?

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Depends what you mean by multiple entries.

    Certainly a report can have multiple records. It can also have a RecordSource with multiple related tables. It can also have subreports. All depends on data relationships and what you want to show. Do you want to show detail raw data as well as summary calcs?

    If you want to select multiple LotNumber values and report only those selected, then that is filtering report for multiple parameters on the same field. Here is one way: http://allenbrowne.com/ser-50.html
    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.

  9. #9
    argsemapp is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    18
    I have an unbound form with a ComboBox cmb_SelProdName bound toAlloyName of my MDB. The user selects an Alloy Name from the combobox, and a Form button On Click event does a DoCmd.OpenReport which should pass the AlloyName to the report "rpt_xTest":

    DoCmd.OpenReport "rpt_xTest", acViewReport, , , , OpenArgs:=Me.cmb_SelProdName

    On the (unbound) report is a bound text box with =[Forms]![OpenArgs] which should display the value in the combobox.
    What happens is, I select the alloy I want, press the button, and immediately get a dialogue asking for "Sample Name". When I type anything, I go to my blank report with #Error in my text box.

    I'm stuck at this point

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    An unbound report will not display data from tables. Is "Sample Name" in the ControlSource property of a textbox on report? What is this report for if it is not bound?

    The report pulls value from its OpenArgs with: = [OpenArgs]
    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.

  11. #11
    argsemapp is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    18
    Quote Originally Posted by June7 View Post
    An unbound report will not display data from tables. Is "Sample Name" in the ControlSource property of a textbox on report? What is this report for if it is not bound?

    The report pulls value from its OpenArgs with: = [OpenArgs]
    THANK YOU I got it to work! I didn't realize the form/report themselves had to be bound, I thought spot querying would be sufficent (even though you said otherwise on your first reply). "Sample Name" is a mystery since I don't have any ControlSources with that property in my report... I shall investigate! Also =[OpenArgs] was a problem as well.

    Thank you again officially done with [this] thread...

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

Similar Threads

  1. Replies: 3
    Last Post: 03-11-2013, 05:11 PM
  2. Replies: 1
    Last Post: 06-26-2012, 08:19 PM
  3. Replies: 1
    Last Post: 01-10-2012, 03:44 AM
  4. Replies: 1
    Last Post: 07-15-2011, 10:59 PM
  5. Replies: 4
    Last Post: 12-13-2010, 05:33 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