Results 1 to 4 of 4
  1. #1
    tonycl69 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    102

    Passing an ID from both main form and subform


    HI, I have a one to many relationship between 2 tables, the form has been created with the one side as the main and the many side as a continuous subform, I would like to print a record where the main form id is passed and the selected subform record has been selected not a report that repeats the form if that makes sense.
    This is what I have at the moment.
    DoCmd.OpenReport "rpt_wpsform", acViewPreview, WhereCondition:="[tbl_pqr.pqrid]=" & Me.pqrsub.Form.WeldSpecID

    The report opens as it should but no data is being passed. any help would be appreciated, it is also difficult to give you a slice of the database, sorry.

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    you can never go wrong with the full path....
    main form
    forms!myform!txtID

    or sub:
    forms!myForm!child1!form!txtID

  3. #3
    tonycl69 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    102
    Thanks for your help on that, but still not passing info to the report, this is what I have now after putting your advise into place.
    DoCmd.OpenReport "rpt_wpsform", acViewPreview, WhereCondition:="forms!tbl_pqr!pqrid=" & Forms!tbl_pqr!pqrsub!Form!WeldSpecID

    But I ma now getting an error pop up 'Access can't find the filed ';form' referred to in your expression.

  4. #4
    tonycl69 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    102
    Solved the problem I based opening the report on the subform ID alone and that sorted it, rather than trying to pass both the main form ID and the subform ID to the report.

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

Similar Threads

  1. Replies: 4
    Last Post: 11-06-2014, 05:35 AM
  2. Replies: 6
    Last Post: 07-16-2014, 12:18 PM
  3. Replies: 3
    Last Post: 04-17-2012, 10:28 AM
  4. passing variable from modal form to main form
    By crowegreg in forum Forms
    Replies: 2
    Last Post: 06-03-2011, 05:34 PM
  5. Replies: 3
    Last Post: 06-02-2009, 09:51 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