need help to lock a field

Fugan

Registered User.
Local time
Today, 15:47
Joined
Aug 7, 2006
Messages
16
lock textbox if ticked NO on other field plz help

I'm doing a project for Tafe and i have some yes no questions on my form and
a text box next to each one for detials if the answer was no for tick box i want
the text box not to be able to write in can someone help me plz
______________
David
 
Last edited:
I would set the enabled property of the textbox to "no"

and place an after update code on the yes tick box:

Private Sub 'NAMEOFTICKBOX'_AfterUpdate()
If 'NAMEOFTICKBOX' = -1 Then
'Nameoftextbox'.Enabled = True
'Nameoftextbox'.SetFocus
Else
'Nameoftextbox'.Enabled = False
End If
End Sub
 
Melax29,
i did what u said but it still does not do anything i think i might be
doing it wrong or something

Private Sub Check26__AfterUpdate()
If Check26 = -1 Then
Case_Detials.Enabled = True
Case_Detials.SetFocus
Else
Case_Detials.Enabled = False
End If
End Sub

it does not do anything when i tick the yes box the textbox is just not able all time now i don't no much about doing code in access just started doing access this year
plz help again and ty for helping first time
___________
david
 
Did you change the enable property for the case details to No?

Can you zip your db and attach?
 
Melax29,
all the feilds that are yes or no
if no the feild next to them to be not use able so u can't put data in them ones plz help and ty for helping me
_________
David
 

Attachments

Try this

Code:
Private Sub Check26__AfterUpdate()
If [COLOR="Red"]Me.[/COLOR]Check26 = -1 Then
[COLOR="Red"]Me.[/COLOR]Case_Detials.Enabled = True
[COLOR="Red"]Me.[/COLOR]Case_Detials.SetFocus
Else
[COLOR="Red"]Me.[/COLOR]Case_Detials.Enabled = False
End If
End Sub
 
Last edited:
Fugan,

the reason it doesn't work is because you're not using check boxes but option groups...

Put this code in the Before Update event of your first Option Group:

If Me.Frame23 = 2 Then
Me.Case_Detials.Enabled = True
Else
Me.Case_Detials.Enabled = False
End If

Put the same code in the On Current event of your form.

You'll have to create similar code for each and every Option Group.
And you'll have to add that to your On Current event code.

PS Detials is spelled Details :D

RV
 
Is this what you are after?

I did the first two...you might want to fix up your spelling, it is supposed to be details not detials isnt it?

I adjusted Falts to faults...

Anyway if this is what you are after, add the code rv stated except the code is actually 1 to enable the text box

If Me.Frame23 = 1 Then
Me.Case_Detials.Enabled = True
Else
Me.Case_Detials.Enabled = False
End If
 

Attachments

To all,
yes ty so much for your help with this
__________
David
 

Users who are viewing this thread

Back
Top Bottom