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 dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to use a check box to populate 3 text boxes 2

Status
Not open for further replies.

kjpreston

Technical User
Jun 3, 2005
34
US
I need to be able to use a check box to populate 3 text boxes. if the box is checked I need specific information to appear in the text boxes, if the box is NOT checked I need to be able to enter information in the boxes. How can I do this?
 
Hi!

In the After Update event for the check box and in the Current event of the form use this code:

If YourCheckBox.Value = True Then
TextBox1.Value = "YourText"
etc.
Else
TextBox1.Value = "YourOtherText"
etc.
End If

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Assuming this is a bound form and all three text boxes and the check box are also bound.....

In the form's OnCurrent event...
If Me.YourCheckBox = True Then
Me.Your1stTextBox.Enabled = False
Me.Your2ndTextBox.Enabled = False
Me.Your3rdTextBox.Enabled = False
Else
Me.Your1stTextBox.Enabled = True
Me.Your2ndTextBox.Enabled = True
Me.Your3rdTextBox.Enabled = True
End If


You could use the Locked property instead of Enabled if you don't want the grayed out appearance.


Randy
 
The if statement works for the first 2 text boxes, but it keeps giving me an error for the third one. The error is "Identifier under cursor not recognized." I've tried putting in the errant text box in a separte If statement but I get the same error. Could it be the text box name which is 'COSTCENTER'?%-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top