Why am I getting an extra record

Liz_I3

Well-known Member
Joined
Dec 30, 2002
Messages
645
Office Version
  1. 2016
Platform
  1. Windows
Hi
I have an User ID filed on my form that populates when the form is opend to the users logon ID.

On the form I have an add records button. Each time the button is clicked it added the current record plus one with just the userID...why? It always addes this extra record. I assume it has something to do with the UserID being auto populated, but how can I stop it?

I have tried DoCmd.CancelEvent in various places On Dirty On after update etc but it did not help

Thanks
Liz
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Liz

Perhaps the form is automatically adding the record?
 
Upvote 0
You are correct. My issue is I don't know how to stop it? I always get 1 extra record added to my table. The extra record is blank excetp for the UserID which just happens to be the field that is auto populated on load

L
 
Upvote 0
Just an update...
I stopped the auto populate field and access is still adding a blank line to my table every time a close my form
 
Upvote 0
Even when you don't add a new record?
 
Upvote 0
So, if the form is bound to a table, do you have code in VBA anywhere that updates a field when a New Record is populated? If so, then what I am envisioning is happening is that the form loads up, VBA code is run and a field is changed, Access automatically creates a new record. Then, you are pressing a button to add a new record, and so a new record is added after the one that was just altered somehow (be it by VBA or something else). So you are getting two records because when the form loads up, a new record is automatically created.

Hope that makes sense. What you could do is include some form validation measures to make sure that all required fields are filled out before allowing the record to save. This would ensure that a record is completed before saving.
 
Upvote 0

Forum statistics

Threads
1,203,052
Messages
6,053,223
Members
444,648
Latest member
sinkuan85

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top