tab control on a form

  • Thread starter Thread starter jseger22
  • Start date Start date
J

jseger22

Hi, I have a tab control on a form with 2 tabs, the first tab I use to
add records into a table. Why do when I tab from the first to the
second tab do the records get added into the table, is there a way to
stop this? I only want the records to be added into the table when a
command button is pushed.

Thanks
 
You can only do it one record at a time and it takes some coding to bypass
the normal action of a form. If you are trying to add multipe records, you
can't easily do that. It would involve using a local temporary table to do
the entry, then when you want to update the main table, you would use an
append query to add the records.

But, all that being said, were I you, I would reconsider my design.
 
I think you need to explain what you are doing a little better.

I just created a blank form based on a sample table with 4 fields. I added
a tab control to the form, and placed textboxes for two of the fields on tab
page #1 and two textboxes for the other two fields on tab page #2. I entered
data in the controls on tab 1, then clicked on tab page #2 and entered the
data for the other two controls. When I checked to see if I was still on a
NewRecord, I was; none of the data was written until I actually moved to a
new record.

Have you checked the forms "cycle" property (it is on the Other tab) to make
sure it says "Current Record"? If it says "All Records", and the tab order
of your controls is such that the control with the last tab index is on tab
page #1, then you may be leaving the record and going on to a new one.

Do you have any code behind your form, that might be firing and saving the
current record?

Do you have a subform control on the second tab page? If you have a subform
on the tab, when it gets the focus, you main form will also write the record.
To prevent this, you could hide the subform (or the tab page it is on) until
such time as your main forms data is written.

HTH
Dale
 
Back
Top