Results 1 to 4 of 4
  1. #1
    Njliven is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    86

    Auto Fill based on wheter there is a value in 3 other fields.

    Here is what I am facing. Please let me know if this is possible.
    Table A has 3 fields that are dollar amounts and only 1 of these 3 fields will have an entry.
    Then I have Table B that has one field that need the dollar amout in it from one of the 3 fields in table A.
    I have all these fields set up on a form, with a query connecting the two tables.


    So is it possible to auto fill the field in table B with one of the 3 fields from table A based on whether or not there is a value in one of the other 3 fields.
    I hope this makes sense. Thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    It is possible.

    =Nz(field1, Nz(field2, field3))

    That expression will display value from one field, if any have a value.

    Saving that calculated result to table will require VBA code in some event. The trick is figuring out which event, such as a button Click or form Close.

    Me!field4 = Nz(field1, Nz(field2, field3))
    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
    Njliven is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    86
    I get this message that shows up in my field instead of the amount #Type!. Not sure what this means. I made the field a currency field to match the others.

    Before I got your answer I was playing around with it and I got it partly working with the actual field in the form and using if statements to fill the field on Got Focus. However you take an amout out of one of the 3 fields it does not update with a null value. I tried using another if statement for this, but have not been able to get it to work so far.

    If I could get your suggestion to work then I could have it up the table with a On Lost Focus of the field being filled in?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    What do you mean by 'take an amount out of one' - just deleting value? Code should still work.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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. Replies: 2
    Last Post: 01-26-2013, 07:53 PM
  2. auto fill name based on file number
    By mark_w in forum Forms
    Replies: 13
    Last Post: 08-03-2012, 04:59 AM
  3. Replies: 3
    Last Post: 03-21-2012, 01:43 PM
  4. Auto-Fill text fields in the form
    By sk88 in forum Access
    Replies: 2
    Last Post: 01-10-2012, 08:22 PM
  5. auto fill certain text fields?
    By darklite in forum Forms
    Replies: 4
    Last Post: 07-12-2010, 02:20 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