Results 1 to 5 of 5
  1. #1
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85

    Question disable text box based on criteria

    Hello, My form has 3 tabs the tab with multiple bound fields is Inital_Review (screen shot below). I would like the address fields on this tab to be disabled if any of the ProgEligEndReason (6) fields = the following: "Option1", "Option2", "Option3" Otherwise I would like the address fields to remain enabled. Here is what I have to begin, but when I select an item from the combo box it does not update the form automatically after I exit or make a selection to the field. I have tried repaint, refresh or requery after Me.Address.Enabled = False.
    I hope you can get me started as I have a deadline soon to get this completed. Any help will be greatly appreciated.

    printscreen.zip
    Private Sub Form_Current()
    If Me.ProgEligEndReason = "Lic. Suspend/Revoked" Then
    Me.Address.Enabled = False
    Else


    Me.Address.Enabled = True
    End If
    End Sub

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by DCV0204 View Post

    ...but when I select an item from the combo box it does not update the form automatically after I exit or make a selection to the field...
    Your code needs to be in the ProgEligEndReason_AfterUpdate event as well as in the Form_Current event.

    Linq ;0)>

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    one reason it might not be working is if the combo box for Me.ProgEligEndReason is actually bound to a key value of the underlying table so that although it displays "Lic. Suspend/Revoked" the true value of the combo box might be 2 (just an example)

  4. #4
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85
    Ok, that worked for the single field; can you help with applying this to all 6 of the ProgEligEndReason fields with multiple options? Such as
    If ProgEligEndReason or ProgEligEndReason_0 or ProgEligEndReason_1 = "Lic. Suspend/Revoked" Or "Term. by CMS" Or "Suspended by TennCare" Or "Deceased"

    can this be done?
    Thanks.

  5. #5
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    Well, yes, it can be done, but it's going to make for a long IF statements. You have 6 fields, each of which can have 4 values, for a total of 24.

    Your IF statement would be:

    If field1 = value1 or field1 = value2 or .... field6 = value3 or field6 = value4 then

    24 comparisons in all.

    BUT, if you have the time and resources, you database structure should be re-examined. It is not properly normalized, in that you have 3 groups of the same data (Medicaid) repeated within one main record, which is a normalization no-no. What you have is a one-to-many relationship, which always requires two tables (at least).

    This will cause "difficulties" if the business rules change, or there is an exception, where there can be more than three MedicAid groupings.

    HTH

    John

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

Similar Threads

  1. Replies: 9
    Last Post: 06-04-2014, 10:45 AM
  2. Counting text entries based on criteria
    By benjammin in forum Queries
    Replies: 6
    Last Post: 07-22-2013, 09:55 AM
  3. Replies: 2
    Last Post: 05-16-2012, 04:45 PM
  4. Summation of Types (based on text criteria)
    By justinwright in forum Reports
    Replies: 4
    Last Post: 01-26-2011, 01:07 AM
  5. Disable fields based on another.
    By scottay in forum Forms
    Replies: 0
    Last Post: 08-10-2010, 05:40 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