Clear Subform and Form with Command

I have a form (frmCashSales) and I have a subform which is continuous (sfrmSalesDetails) on that form. What happens is when a product is selected and added to an order it goes from a drop down on the form into a line in the subform, users can enter as many products as they like, but when they complete the order, I would like the form and subform both to be cleared so a neworder can be started.

Sponsored Links:

Related Topics

Clear a form without gettingerrors
Using a form to edit detail in a subform in Access 2003. When the users open the form; the fields are populated with previous data. The form has a recordsource of a table and the subform has a recordsource of a query.

The users select invoice number from a unbound field on the main form which loads applicable data in the subform. I put a clear button on the main form to clear the fields but it gives me errors about how I can't change the record because it would cause duplicates.

How do I clear the fields when the users exit the form without gettingerrors.


How to clear form without setting DataEntry property to yes
I would like to clear the data displayed in a subform with VBA using a button, similar to when you have the DataEntry property set to NO, and then has to close and open a specific form, to clear it.

In short, the data will be displayed in form until you clear it with a button - (dataentry will be yes, till you press the clear button)

My reason for doing this - when I temporarily close the main form and return later, all data captured are deleted from the subform, and I then have to check what was the last data captured, before continuing with the next lot. This wastes time.

the main form is "StocktakeF"
the subform is called : "Fis_stocktakeSF"


How to change the properties of a command button on a subform
I have a form with a subform in a tab control. on the subform I have command buttons (Add, View, Delete) the properties of these commands is set to Enabled = No.

When I click a command button on the form (Unlock) I want it to make the command buttons on the subform to become enabled.

How do I go about changing the properties of a command button on a subform?


how to clear highlighted fields with a command button
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?


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


Hide subform and clear the space left
Is there a way to hide the subform in a main form and clear the space which is blank? I mean when I made the subform visible property to false it still takes some space in the main form, could I make it disappear completely and it did not take some space any more until I set the visible proper to true


Clear selected value in combo box
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
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.


Preview Report Command That Can Do More
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?


Call a button on the main form from the subform
I have a Form

Command
and a subform
Order

I use the subform to order some mats to get the job done and I want the production_date on the Command Main form to be the latest date from the subform field Reception_Date to be my production date.

So I did a button on the main form(Command) that does this.BUT!

I want to enter some code in the On change Reception date from the subform to call my button code. and I can't do it.


Clear records off of continuous form
Im trying to find a command to clear all the records on a continuous form that were called up using a strWhere Filter and combo boxes.

There are four unbound combo-boxes in the header that the user can choose from and then I have a command button coded to filter (Me.FilterOn) for those criteria.
The matching records display in the details section of the form (continuous-style).

Is there a command to reset the details section of the form to be blank? Ive tried refresh, requery, repaint, etc. All of these leave the previously queried data. Removing the filter doesnt work because that display all the records. I basically want the form to look exactly the way it did when it was first opened.


VBA to clear or reset text fields from a click of a command button
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?


Subforms on form
The database I have created has a large subform on it, which is a table for me to enter in information for that record, but I'm having problems with it.

When I open the form I add data to the form and subform, but when I click the button for a new record it makes a new one and clears the writing so I can fill out the new record. But it does not do it for the subform.

How can I do it so that when I click new record it will clear the data on the form and subform, so that when I switch through the records then the data will change showing the correct information in the subform?


Command button to close and return to original form
I have a subform with a command button that will return the user to the main form. However, the subform remains open. I'd like the command button to also close the subform on click.


Use command button to change recordsource in subform?
I have some queries that run when I click the command buttons. But, they open in a new window. I want them to open up in the subform that I put in the Parent form. How can I get it to workso when I click on the command button and instead of a new window it will populate my subform?


Doevents vs a timed Pause
I am a little confused in the use of Doevents compared to introducing a pre-defined Pause.

For example, I have a form and a subform that has several records; e.g. an Invoice form with the subform of ordered products and prices. The subform calculates the total order value and then returns this number to the main invoice form.

Standard stuff I know but often I have to wait for the subform to complete the addition calculation before (say) command button printing the invoice from the main form.

I usually introduce a 2 second pause before the print command to ensure the subform total calculation has completed.

Would Doevents do the same thing? I don't think so in which case what is Doevents used for


Command button to open a subform
I created a subform by dragging a form over another, it all works OK as it gives me details about the item Im dealing with in one screen in 2 forms (the main - 'Progress/Status' and subform - 'Saving')

However there is so much detail on the screen and I would like to create a command button on the main form that opens a subform with information only for the current record. I tried to create the command button, but it opens thesubform in form view with all the other records in that form which I dont want to see.

Can you please advice me on how I restrict it give information about the current record and not all records present in the form


Form/Subform Command Button & Links
I have a form that I would like to keep in "Continuous Form" view but also need a subform of sorts that can be opened with a DblClick or Command Button. I know technically you don't "open" a subform - it's linked to the parent table, however Access doesn't allow for the insertion of a subform if your parent form is in continuous view.

Is there a snippet of code that can open a form and define it as a child form and link master/child fields? Or any other method of opening a form with a command button and have it linked to the parent table by a PK field


Export Subform Results
Address, etc). In that form is a subform linked together by customer number which shows product detail for that customer.

I have a command button that allows people to access this subform. What I need is to create a command button that will take those results and export to excel. I know how to create a macroto link to that subform, but it does not filter by customer, it exports all results in the subform.


Using strLink operator for Subform
I have a form that uses the strLink operator, under a command button, that open a small form, used to auto-sort records based on whatever fields the user want to select. Works great, however I have the need to split my form into a main & subform format.

For formatting and space limitations, I wouldl like to keep the command button on the main form. I have tried a couple different method of changing the strLink command line to try and put focus on the subform. I have tried:

strLink = "frmSub" and strLink = Forms!MainForm!frmSub

but neither have obviously worked. I keep getting a form cannot be located error. I search the site for "strLink" threads but there was no help available.