Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2009
    Posts
    11

    Unanswered: Each option linked to activate text field within Option Frame

    I have crated 4 fields within a table, namely

    Field 1: Score A
    Field 2: Score B
    Field 3: Score C
    Field 4: Score D

    Each score has a validation rule:
    Score A: 0-8
    Score B: 9-12
    Score C: 13-14
    Score D: >=15

    I have created 4 options within a form related to each of the above:

    Option 1: text box Score A
    Option 2: text box Score B
    Otpion 3: text box Score C
    Option 4: text box Score D

    These fields also appear within a form next to each option within a frame, i.e.:

    o Option 1: Score A
    o Option 2: Score B
    o Option 3: Score C
    o Option 4: Score D


    The frame has the following code added within properties of the frame - Event - After Update:
    Option Compare Database
    Private Sub Form_Load()
    Me.ScoreA.Enabled = False
    Me.ScoreB.Enabled = False
    Me.ScoreC.Enabled = False
    Me.ScoreD.Enabled = False
    End Sub
    Private Sub OptGrpAuditScore_AfterUpdate()

    If Option1.Value = 1 Then
    Me.ScoreA.Enabled = True
    ElseIf Option2.Value = 2 Then
    Me.ScoreB.Enabled = True
    ElseIf Option3.Value = 3 Then
    Me.ScoreC.Enabled = True
    ElseIf Option4.Value = 3 Then
    Me.ScoreD.Enabled = True
    End If
    End Sub

    Each time an option is selected, i.e. Option 2, then the text box for Score B (Field Name: ScoreB) should be enabled.

    Also if the use has selected the wrong option and therefore entered the wrong info in the related text box then they should somehow be able to correct this and then select the correct option and enter the correct data in related text box to the selected correct option.

    Does the above make any sense? Hhhhheeeeellllp.

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You have to enable/disable all textboxes, not only one of them:
    Code:
    Private Sub OptGrpAuditScore_AfterUpdate()
    If Option1.Value = 1 Then
    Me.ScoreA.Enabled = True
    Me.ScoreB.Enabled = False
    Me.ScoreC.Enabled = False
    Me.ScoreD.Enabled = False
    ElseIf Option2.Value = 2 Then
    Me.ScoreA.Enabled = False
    Me.ScoreB.Enabled = True
    Me.ScoreC.Enabled = False
    Me.ScoreD.Enabled = False
    ElseIf Option3.Value = 3 Then
    Me.ScoreA.Enabled = False
    Me.ScoreB.Enabled = False
    Me.ScoreC.Enabled = True
    Me.ScoreD.Enabled = False
    ElseIf Option4.Value = 3 Then
    Me.ScoreA.Enabled = False
    Me.ScoreB.Enabled = False
    Me.ScoreC.Enabled = False
    Me.ScoreD.Enabled = True
    End If
    End Sub
    Have a nice day!

  3. #3
    Join Date
    Mar 2009
    Posts
    11
    Thank you for your speedy response, I will try as you suggested and let you know the outcome.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •