Topics Search

Command button code to clear form

Command button code to clear form
Views: 159
I would like to have a command buttom on my form and on click clear all entries. Please help with the code?
Sponsored Links:

More topics

 

Preview Report Command That Can Do More

Preview
Access 2010 - I have a search form where end users enter parameters. I used the command wizard and created a preview report command button so the report tab comes up in preview mode just fine.

I also created a Clear Entry command button that works. However if I leave the report open in preview mode and go back to the form tab, hit the Clear Entry button, then enter new parameters, the report data doesn't change from the previous entry.

1. Will the end user have to close the report manually each time before entering new parameters?

2. If not, where is the Close Report command button? I could only find Close Form.

3. What's the code to create a command button to refresh the report?

4. Finally, can everything (preview report, clear entry, refresh data) be done using just 1 command button? Can't I add the code I need behind one command?
 

how to clear highlighted fields with a command button

Preview
I have multiple fields in a form that use a macro event to highlight the backcolor of the field when the data is changed. I would like to be able to clear the highlighted fields with the click of a button.

I have a command button programed to save the record and would like it to clear the highlights for me as well. What is the best way to accomplish this goal?
 

VBA to clear or reset text fields from a click of a command button

Preview
Is it possible to add vba code to a command button that when clicked the event will clear existing data or reset data, so when the user is on the form, the previous data entereddoesn't display? if so how can this be done?
 

Clear selected value in combo box

Preview
I have a combo box on a form. The user selects a value then presses a command button and opens a form. When the user closes the form returning to the 1st form again, I'd like the combo box to be clear again.

I've tried putting me.combobox=null in just about every event the main form has but nothing works. Is there a way to clear this without putting me.combobox=null in the On Click event of the command button? I have quite a few command buttons on that form and don't want to have to put the code in all of them if I don't have to.
 

Clear selected value in combo box

Preview
I have a combo box on a form. The user selects a value then presses a command button and opens a form. When the user closes the form returning to the 1st form again, I'd like the combo box to be clear again.
I've tried putting me.combobox=null in just about every event the main form has but nothing works. Is there a way to clear this without putting me.combobox=null in the On Click event of the command button? I have quite a few command buttons on that form and don't want to have to put the code in of them if I don't have to.
 

Command button to clear checked combo box

Preview
I was hoping someone would be able to tell me what the code is if I want to program a command button to clear the check mark made in a combo box. Basically we want a way to clear that fieldif it was checked incorrectly.

Also, how can I make multiple check boxes that are bound to a single field? I want to basically have a combo box structure where more than one box can be checked it it applies.
 

Command button click event

Preview
I have a very simple form, couple of text boxes and a Command Button. On Click event of command button I want to clear all my text boxes but when I click nothing happens.

Private Sub CmdReset_Click()
MsgBox "Clear", vbOKOnly
TxtVendorName.Value = ""
TxtDesc.Value = ""
TxtOrderDay.Value = ""
TxtDeliveryDay.Value = ""
TxtComments.Value
 

Clearing specific cells with command button

Preview
Is it possible, on the click of a button, to clear the contents of a particular cell(s) in a table?

I have a data entry form. On the click of a button I want to be able to purge all of the information in the underlying table except the clients ID and Name etc.

I dont want the whole record to be deleted, just clear the individual cells
 

Save & Clear Button + Disable Enter

Preview
I have one command button in my form. I want my button to

1. SAVE the data upon click of button and CLEAR all fields for new data entry

2. I noticed that when I press the ENTER it will do same action as clicking my button. I tried the "on Enter event" and create a Message Box when Enter is pressed. it works, but when I press Enter again. it will proceed with the data transfer. I want to DISABLE the Enter command to transfer the data. I want the user to use the Button Only to transfer the record
 

Clear form help needed

Preview
I am looking for some help via macro or some type of code I can attach to a button on a form so it would clear text / combo boxes on the form. There are some very novice users that use the database and the form has some data validation rules so they at times will get stuck when they have entered a wrong number.

I am trying to add a button that if they get confused willclear the for for them and they can start over.