Results 1 to 6 of 6
  1. #1
    CS_10 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2014
    Location
    Derbyshire, UK
    Posts
    32

    Passing value from form to sub form query

    Hi there.
    I have a form that contains a sub form on it.

    On this sub form I have a report that produces a list of the information entered in the sub form that is related to the record on the form.

    Currently I have to enter the ID that I want as part of the query, however, I'm sure there must be a way to automatically pull this ID field through from the main form?

    Can anyone help?

    Thanks,



    Craig

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    You have report object on a form?

    Did you set the Master/Child Links properties of the subform/subreport container control?
    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
    CS_10 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2014
    Location
    Derbyshire, UK
    Posts
    32
    Hi there.

    The report isn't directly on the sub form.

    I have a button on there which triggers a query for the report.

    It's a value from the main form that I want to pass through automatically to the query so I don't have to type it in the prompt.

    Thanks. Craig

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I don't use dynamic parameters in queries. I use WHERE CONDITION argument of OpenForm or OpenReport.

    DoCmd.OpenReport "report name", , , "ID=" & Me!ID

    Access Help or web have more info on those methods and their arguments.
    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
    CS_10 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2014
    Location
    Derbyshire, UK
    Posts
    32
    Quote Originally Posted by June7 View Post
    I don't use dynamic parameters in queries. I use WHERE CONDITION argument of OpenForm or OpenReport.

    DoCmd.OpenReport "report name", , , "ID=" & Me!ID

    Access Help or web have more info on those methods and their arguments.
    Hi June,

    Thanks for the reply.
    The report that I want to open currently gets its data from a query with a criteria on it.

    Do I need to not use this query?

    Or can I pass the value to the criteria prompt?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    If you are using a dynamic parameterized query as report RecordSource, review http://www.datapigtechnologies.com/f...mtoreport.html

    I prefer not to use dynamic parameterized queries at all.
    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. Passing Form Field Value to Query
    By calgarianguy in forum Forms
    Replies: 1
    Last Post: 06-11-2013, 09:35 PM
  2. passing values from form to query
    By gregd in forum Access
    Replies: 6
    Last Post: 05-02-2013, 03:18 PM
  3. Replies: 9
    Last Post: 05-30-2012, 12:57 AM
  4. Passing Form Variable to Query
    By allenrickson in forum Reports
    Replies: 10
    Last Post: 06-27-2011, 07:33 PM
  5. Form not passing data to query
    By bobfin in forum Queries
    Replies: 13
    Last Post: 08-11-2010, 05:28 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