Results 1 to 7 of 7
  1. #1
    tagteam is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    501

    Use data from subform in update query

    I have a form that I use for reconciliation and it has 4 subforms on it. Sometimes I want to update data in the main table based on what appears in the subform. However, When it try to reference the subform in the update query it does not work.



    When i Run it a box pops up: Enter Parameter Value and has the code i used to pull the value Forms!my_subform!fieldname as the description. If I enter the data in the parameter boxes it does update correctly, however, it is not pulling the existing value from the subform, which is what I want it to do.

    Thanks for any help

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    use the BUILDER to insert form parameters into the query. It never gets it wrong.

    but the subform objects look like: forms!fMainForm!subfrm.form!cbobox

  3. #3
    tagteam is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    501
    Ahh, yes, forgot about using the builder. I will try the builder / object string you mentioned. I forgot to include the subfrm.form part.

  4. #4
    tagteam is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    501
    Ok, tried the builder and it gave me the same thing I had built out and I tried adding forms!MainForm!subform.form!field but it doesn't allow that. Once I select forms!MainForm it only gives me options for fields on that form, not another subform.

  5. #5
    tagteam is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    501
    I thought the problem might be because I was using a datasheet view for the subform but even in single form view it doesnt work.

  6. #6
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    I couldn't recall seeing the builder being available to the query parameters so I took a refresher look. Turns out it's not - at least not in my version

    Click image for larger version. 

Name:	aQryParams.jpg 
Views:	10 
Size:	30.6 KB 
ID:	44771
    Are you sure you are trying to define the parameters of the query?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    tagteam is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    501
    I kind of got this work by using a dlookup. On the main form I have three unbound fields. I use a dlookup for the data and lookup the data I need from the subform. So it displays in the subform AND in the main form. Then i can confirm the data and use a regular update query to update using the three unbound fields.

    I never did get the update query to be able to pull the data from the subform and use it in the update.

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

Similar Threads

  1. Replies: 17
    Last Post: 09-30-2016, 05:52 AM
  2. Replies: 3
    Last Post: 11-26-2013, 03:40 PM
  3. subform data update via button
    By ShostyFan in forum Programming
    Replies: 7
    Last Post: 10-30-2013, 07:54 PM
  4. Form update with new data in sub-subform.
    By Degs29 in forum Programming
    Replies: 8
    Last Post: 06-21-2013, 01:56 PM
  5. Replies: 8
    Last Post: 05-30-2013, 05:06 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