Changing a text boxes properties based on value of another textbox

Marbinski

Registered User.
Local time
Today, 11:39
Joined
Aug 24, 2004
Messages
45
I have a form with a combo box with the values Yes or No. If the value on the combo box is Yes, I want the property of another text box to be shaded out or non-editable (textbox to be readable but not editable). But if the combo box value is No I want that other textbox to be accessible to enter data. Basically I'm looking for any type of VB code or something Access can do to help with my situation.

Any suggestions or comments would greatly help....thanks
 
you should try something similar to the following on the AfterUpdate Event of your combo:

If Me.ComboName = "Yes" Then
Me.TextboxName.Enabled = False
Else
Me.TextboxName.Enabled = True
End If
 
Place the code in the FormCurrent event, in the AfterUpdate event of your combo put

Call Form_Current

otherwise the code will not work as you scroll through records
 
I have tried placing the following code in the form properties within the EVENT PROCEDURE (VB Coding Area). And I get the "Expression On Current......Error...Active X...Problem occurred" Msg. I tried putting it with the text box properties and still got the same error....am I doing something wrong?? Please advise...thanks again.

Private Sub Form_AfterUpdate()
Call Form_Current
End Sub

Private Sub Form_Current()

If Me.CICopyRightText = "Y" Then
Me.CICopyrightPlacement.Enabled = True
Else
Me.CICopyrightPlacement.Enabled = False
End If

End Sub
 
This is a real low-tech way I picked up from Mile/SJMcAbney - I can't find the thread so I can't post a link, but here goes:

Make the background transparent on the text box you want to change. We'll call it txtTrans1 for now.

You also have your Yes/No combo box, right? Make a copy of this combo box bound to the same field (delete the label from it) and place it under txtTrans1. Now, if you use Conditional Formatting, this cbo box (and make the text inside as small and unobtrusive as possible), it will give the illusion that txtTrans1 is changing color.

Lo-tech, but it works! (Thanks to SJMcA!)
 
Private Sub Form_AfterUpdate()
Call Form_Current
End Sub

That shouldn't be in the AfterUpdate of your Form, but in the AfterUpdate event of your combo box.
 

Users who are viewing this thread

Back
Top Bottom