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!

Clear Text, Check and Combo Boxes 1

Status
Not open for further replies.

mrkuosea

MIS
Nov 24, 2011
20
0
0
US


I have a form which has Text, Check and Combo Boxes which are connected to corresponding fields in a table.

I am trying to code a 'Clear' fields button to clear/delete contents of these boxes on the form (not table) if the user feels that the data entered was wrong or wanted to start over.

I tried Me.[boxName]="" but I keep getting errors.

Is there another way to do this?

Thanks,
Mark.
 
If the controls are bound to fields in your table, clearing the contents of the controls will change the values in the table (if the record is saved).

I expect your field doesn't allow zero-length-strings (that's typically good) so you would need to use:
Code:
Me.[boxName]= Null

Duane
Hook'D on Access
MS Access MVP
 

Duane,

I tried Me.[boxName]= Null but I get an error saying that a value should be entered in the first field of the table.

Is there a refresh or reset option that can work in the place of Null or ""?

The clear command button will be mostly used as a undo option before the record is actually saved.

Thanks,
Mark.
 

Duane,

I was getting that error because the first field of the table was the primary key.

I used Me.Undo as you suggested. It works perfectly.

Thanks,
Mark.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top