Dynamic Invisible fields event

adams.bria

Registered User.
Local time
Today, 13:24
Joined
Apr 28, 2010
Messages
41
Forms are being used for survey entry. Some fields are visible/invisible based on the input of other fields. For example, question 1b only turns visible if 1a is "3". My issue is actually with tabbing. Because I used LOSTFOCUS as my event, the tab already occurs before field is visible, even when 1b turns visible it tabs to question 2. Yes the tab order is set correctly, I know this because when it is visible if I got back to 1a and tab it goes to 1b. I am almost certain it is the event I am using, but I don't know what to use instead. Any ideas?
 
I would use the After Update event of the 1a text box. If it is 3 then make 1b visible and set the focus there, otherwise hide 1b and set the focus elsewhere. Example;

Code:
Private Sub txt1a_AfterUpdate ()

    If Me!txt1a = "3" Then
        Me!txt1b.Visible = True
        Me!txt1b.SetFocus
    Else
        Me!txt1b.Visible = False
        Me!txtQuestion2.SetFocus
    End If

End Sub
 

Users who are viewing this thread

Back
Top Bottom