Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make field conditionally editable? 1

Status
Not open for further replies.

msf11

Technical User
Apr 10, 2003
15
0
0
US
I have a text box on a form that I only want to be able to edit if a combo box has a certain value. Does anyone know how I can do this? Thanks for your help!

-marc
 
Hi!

Use the following procedure:

If Me!MyComboBox.Value = "YourCondition" Then
Me!MyTextBox.Enabled = True
Else
Me!MyTextBox.Enabled = False
End If

Call this procedure for the Form_Current event and the combo box's AfterUpdate event.

hth


Jeff Bridgham
bridgham@purdue.edu
 
This worked great for my form that only displayed one record at a time. I also have a form that displays multiple records at a time. Where can I put this code so it will also work on this form for each record that is displayed? Thanks!

-marc
 
Hi marc!

This code will work for that form as well. All of the text boxes will look like they are editable but when you move to a record where the box cannot be editted they will change. You may want to use the Locked property instead so the boxes will not change their look when they become uneditable. As far as I know, in a datasheet or continuous form you cannot make the text box enabled in one record and not enabled in another.

hth


Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top