Results 1 to 5 of 5
  1. #1
    VikingMax is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    3

    Compare two fields and populate thirds field if the two field match.

    I am working on an Access DB., I would like to compare two fields and if they match I would like to populates this field with data from a third field. I have tried IIF and work great, but I have to many nested IIF statement.



    This is for a workout program for our atheltes. Ex: Johnny has a bench max of 145 lbs. He will use the following workout - 90 , 100, 115. I want the db to compare the workout to another field and then update the Weight on Bar if the workout and field are equal



    Table 1 has player and bench max. I created a query of the bench max to produce the workout weight. Table 2 has the weight, say 90lbs, and the amount of weight that should be put on the bar to get to this weight. This table goes from 45 lbs to 650lbs. Johnnys workout weight is 90 lbs so he should put 2 -10's 0o the bar. The cells that are colored are what I want the db to produce.
    Hope this makes sense.

    Thanks for any help...

    Robert

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,942
    Your explanation of what you want to do is not very clear. You want to do a search of Table2 to get the weight values that should be added to attain total weight of apparatus? That should not be hard with a DLookup expression. Need better understanding of data and forms. If you want to provide project by attaching to post, will look at.
    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
    VikingMax is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    3

    More information

    attached is the db. if you look at the Workout form, you can see that Charles Simpson has a Bench Max of 140. His warmup weight is 85lbs and the weight for the bar is 2-10's. This (weight for the bar) was acheived by and IIF statement, but the IIF statement runs out when I get to 115 and I need to goto 600. I want the db to auto updtae each of the weights for the bar based on the warmup or workout weight.

    Hope this helps and thanks for any help.

    Robert

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,942
    Try this in the Workouts query:

    Expr2: DLookUp("bwWeights","weights","bwWeight='" & [bwWarmUp x 10] & "'")

    Note the use of apostrophe delimiters because you have the bwWeight field set as a text instead of number type.
    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
    VikingMax is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    3
    You are the man..... the only problem I had was [bwWarmUp x 10]... should have been [bWarmUp x 10].....

    Thanks for all your help.......

    Robert

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

Similar Threads

  1. Fields populate based on another field
    By jlclark4 in forum Forms
    Replies: 3
    Last Post: 12-27-2011, 05:21 PM
  2. Replies: 3
    Last Post: 08-05-2011, 08:13 PM
  3. Populate one field based upon another fields data
    By BigBrownBear in forum Queries
    Replies: 1
    Last Post: 03-23-2010, 04:27 PM
  4. Replies: 1
    Last Post: 02-03-2010, 09:17 PM
  5. Replies: 1
    Last Post: 02-26-2009, 11:31 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