Results 1 to 2 of 2
  1. #1
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481

    Disable a field based on the results of value list.

    Hi,



    I have a main form named as "Test Transaction" and a subform named as "Position Results". I have many fields at main form (may not discuss) and some at subform which are named as:

    PositionNo (PK)
    TestNo (FK)
    TestDate
    TResult (Value List includes only Passed/Failed)
    Reason (Como box of several reasons if test failed)

    I am interested to apply a code that should disable the field "Reason" if "TResult" is passed and vice versa.

    Private Sub TResult_AfterUpdate()
    If Me.TResult = "Failed" Then
    Reason.Enabled = True

    Else
    Me.TResult.Value = "Passed"
    Reason.Enabled = False
    End If
    End Sub


    and at subform on current event

    Private Sub Form_Current()
    If Me.TResult = "Failed" Then
    Reason.Enabled = True

    Else
    Me.TResult.Value = "Passed"
    Reason.Enabled = False
    End If
    End Sub



    I get this code from forum and applied. It works fantastic but the issue is when i starts data entry at main form (1st field) then it started to show the pop up msg " You must enter the a value PositioNo" because when form is loaded the focus is also at subform's field "TResult".


    Kindly advise the needful.

  2. #2
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Hi

    The above code works perfectly but there is one issue only.

    When during a transaction the TResult value is "passed" then the "reason" field is disabled through out the transaction (lets say 8/10 entries) but if once Tresult "Failed" is selected then it enable the field "reason" to select but it does not disabled the field reason for the next entry even if the TResult is "Passed".


    Kindly advise the needful.

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

Similar Threads

  1. Replies: 7
    Last Post: 01-26-2016, 01:33 PM
  2. Return multiple results based on a field
    By johnnythered in forum Access
    Replies: 1
    Last Post: 08-27-2015, 10:35 AM
  3. Replies: 3
    Last Post: 12-09-2014, 07:03 PM
  4. Replies: 13
    Last Post: 11-11-2014, 02:43 PM
  5. Field selection based on quey results
    By Xarkath in forum Access
    Replies: 1
    Last Post: 06-14-2013, 04:37 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