Results 1 to 2 of 2
  1. #1
    Griffin410 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    10

    How to clear values in specific fields based on updating the value of another field?

    Simple question, working on form where the user selects either "IN" or "OUT" from a dropdown of field name "CheckOut" in Frm1.



    If they select "OUT" they will in turn need to fill in 2 additional fields. When they change the value back from "OUT" to "IN", I want those other fields to be cleared of data for just this record so next time they change back to "OUT" from "IN" those 2 additional fields are already blank.

    Thank you.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Let's assume your two additional fields are FIELD1 and FIELD2 and your In/Out field is called FIELDINOUT

    in the ON EXIT property of FIELDINOUT you could have (assuming the field is a value list of 'in' or 'out' in a combo box)

    Code:
    If FieldInOut = "In" Then
        Field1 = null
        Field2 = null
        Field1.visible = false
        Field2.visible = false
    Elseif FieldInOut = "Out" Then
        Field1 = null
        Field2 = null
        Field1.visible = True
        Field2.visible = True
    Else
        'Do your else here
    Endif
    This is a bit heavy handed if you are doing this for a lot of controls on your form so you may want to consider more elegant solutions if this is a more substantial form.

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

Similar Threads

  1. Replies: 3
    Last Post: 04-01-2015, 09:46 AM
  2. Replies: 5
    Last Post: 07-29-2014, 11:20 AM
  3. Access: Updating Null Fields with values
    By bmaz in forum Queries
    Replies: 2
    Last Post: 10-11-2011, 05:18 PM
  4. Count of field based on specific values
    By tazzmann67 in forum Access
    Replies: 2
    Last Post: 03-30-2011, 09:11 AM
  5. clear field values
    By surrendertoo in forum Queries
    Replies: 0
    Last Post: 02-23-2008, 10:57 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