Restrict user input in a textbox depending on what iption the user has selected (1 Viewer)

brainox

Registered User.
Local time
Today, 04:58
Joined
May 22, 2013
Messages
24
I am building a form in access and I am trying to find a way where user input isn't possible in the associated textbox when "No" from on option box is selected, I understand that I might have to use VBA, but I am very inexperienced with it so any help and ideas will be greatly appreciated, many thanks
 

pr2-eugin

Super Moderator
Local time
Today, 04:58
Joined
Nov 30, 2011
Messages
8,494
Hello brainox, Welcome to AWF.. :)

You need to implement the Form Current event to get this working.. Something along the lines of..
Code:
Private Sub From_Current()
    If Me.optionBoxName = 2 Then
        Me.TextBoxToLock.Enabled = False
    Else
        Me.TextBoxToLock.Enabled =True
    End If
End Sub
The value 2, is based on the assumption the option box, which might be radio button, having two options Yes = 1 and No = 2.. But if it is something else, just change it accordingly..
 

brainox

Registered User.
Local time
Today, 04:58
Joined
May 22, 2013
Messages
24
That worked perfectly, thank you very much
 

Users who are viewing this thread

Top Bottom