Results 1 to 7 of 7
  1. #1
    BACKALIFE is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2016
    Posts
    8

    Loop through subrom records by condition from out the Main from

    Hello all,
    Using a button on the main form, I would like to assign a number to a text field called "Ref" of each record in the subform only where the corresponding Yes/No field called "Received" is true.

    Could someone help me do that.



    Thanks.

  2. #2
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    The Received field is on each the subform record? Also what number are you wanting to add to the subform records?

  3. #3
    BACKALIFE is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2016
    Posts
    8
    The number I am willing to assign is a Dmax + 1 I calculate using a numeric field in another table where references are stored.
    So I am trying to assign that number to all those records that the corresponding Received field is true.

    I wish I am clear now.

    Thanks for your help, Bulzie.

  4. #4
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    I was thinking an update query where you use the key field and the Received field as the criteria to limit it to those subform records. Then for the Ref field in the UpdateTo row, put the reference path to that number? You can call the query from the button or somewhere else so first just get the update part working whether that is a query or vba code. Others might have spiffy code to do this also.

  5. #5
    BACKALIFE is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2016
    Posts
    8
    Bulzie, Thank you very much for your help.
    I was thinking there was a better way to do it, but an update query like you suggested is no doubtfully best.
    I know at times stupid thinking takes over

  6. #6
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    Good Luck!!

  7. #7
    BACKALIFE is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2016
    Posts
    8
    Thanks a lot sir, appreciate your help.

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

Similar Threads

  1. Add or condition to loop
    By tagteam in forum Access
    Replies: 2
    Last Post: 03-13-2017, 07:58 PM
  2. update records if condition met!
    By TallSA in forum Queries
    Replies: 5
    Last Post: 08-17-2015, 07:57 AM
  3. Replies: 17
    Last Post: 04-07-2014, 07:48 PM
  4. Replies: 1
    Last Post: 04-08-2013, 11:58 AM
  5. Replies: 5
    Last Post: 08-13-2010, 07: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