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 fields in forms. 1

Status
Not open for further replies.

lvengineer

Technical User
May 19, 2003
9
US
Hello programmers et al,
Recently a asked a question here (thread #702-553655) and got some great answers.
For a novice programmer (hardware engineer) this programming stuff is challanging/but fun!
My text box clearing code clears the text boxes but requires I SetFocus on each text box first. No problem, it works.
txtDate.SetFocus
txtDate.Text = ""
txtEmployee.SetFocus
txtEmployee.Text = ""
etc.
Works GREAT, Thank you.

I am still unable to clear the combo boxes:
cboMyComboBox.SetFocus
cboMyComboBox.RowSource = ""

Doesn't work??? Actual code:

txtDate.SetFocus
txtDate.Text = ""
txtIncidentNumber.SetFocus
txtIncidentNumber.Text = ""
cboEmployeeName.SetFocus 'Sets focus on first cbo
cboEmployeeName.RowSource = "" 'Clears first cbo
cboException.SetFocus etc.
cboException.RowSource = "" etc.
cboTime.SetFocus etc.
cboTime.RowSource = "" etc.
cboEmployeeName.SetFocus ' returns focus to first field

The row sources are simply a table's field contents which get saved (saved record) to another table when the user finishes entering info.

Any ideas anyone??
If I get this working by next week, I get a bonus and I WILL make a donation to this wonderful site.

Thanks in advance,
Bruce








I am still unable to clear the combo boxes:
 
Also, you need to requery your combobox once you have changed its value.

I learned the following code in this forum. Don't ask me why it works because I do not know. It is a brute-forced requery:

Code:
Me.YourRowSourceHere.RowSource = _
Me.YourRowSourceHere.RowSource

Judge Hopkins


There are only two rules for success: (1) Never tell everything you know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top