Results 1 to 3 of 3
  1. #1
    Ant_Snell is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Jul 2021
    Location
    UK
    Posts
    78

    VBA to enable a field based on option in combo box

    I have a combo box on a form named “Bill_Payer” with a label of “Who will be paying for the therapy? Most options are bill payers with an additional option of “Other” option ID 12. The next field is a text field “BillPayer_Other” with the label “If other selected, please specify:”.
    The text box “BillPayer_Other” is not enabled. I would like this field to become enabled only if “Other” option 12 is selected in the “Bill_Payed” combo box and if the content of “Bill_Payer” then changes to anything other than option 12, clear the content of “BillPayer_Other” and re set it to not enabled.
    Can anyone help with the VBA code to do this please? Sorry I am sure this is quite basic but novice level when it comes to VBA.



    Thanks

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    2,051
    In the afterupdate event of the BillPayer control
    Code:
    If Me.BillPayer = 12 Then
        Me.BillPayerOther.Enabled = True
    Else
        Me.BillPayerOther.Enabled = False
        Me.BillPayerOther = "" 'Or Null of you prefer'
    End If
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Ant_Snell is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Jul 2021
    Location
    UK
    Posts
    78
    Perfect Welshgasman THANKS

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

Similar Threads

  1. Requery sub form based on combo box option
    By enginerdUNH in forum Programming
    Replies: 2
    Last Post: 02-26-2018, 04:39 PM
  2. Enable Page based on selection from combo box
    By Nadine67 in forum Access
    Replies: 21
    Last Post: 03-10-2016, 08:29 PM
  3. Run report based on Option and Combo Boxs
    By AussieGal in forum Access
    Replies: 3
    Last Post: 02-20-2013, 08:24 PM
  4. Replies: 3
    Last Post: 12-02-2012, 09:38 AM
  5. Replies: 1
    Last Post: 02-25-2011, 10:03 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