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

Clearing controls in access forms 2

Status
Not open for further replies.

lvengineer

Technical User
May 19, 2003
9
US
Hello,
My first database form uses a "clear" command button to clear text boxes, etc.

VB6 code for this is txtName.txt = ""

Is it the same in VBA for access?

Also, how would you write a line of code to clear a combo box?

Thank you in advance,
Bruce
 
For clearing text boxes, it depends...

If your text box is unbound, then

txtName.txt = ""

should work just fine. If, on the other hand, the text box is a bound control, then it depends on the datatype. Some datatypes require "" and other datatypes require Null.

For combo boxes, you use the RowSource property.

In this case, it doesn't make any difference whether its a bound control or not.

cboMyComboBox.RowSource = "" works whether the RowSource is a Table/Query, or a Value List, or a Field List.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top