We help IT Professionals succeed at work.

Empty Record being created

seamus9909
seamus9909 asked
on
100 Views
Last Modified: 2017-03-30
I have a form where the user will update the recordset, and after closing the form, there is a blank record (other than key) created.

I have looked at the events on the form nothing other than form refreshes being performed.  I can not find any reason why an additional record is created when the user updates an existing record via the form
Comment
Watch Question

CERTIFIED EXPERT
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
John TsioumprisIT Supervisor
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Probably you have something "extra" in your code that is "pushing' the empty data....breakpoint/debug your data along with constantly querying the underlying table to see when the empty record is inserted....
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
CERTIFIED EXPERT
Top Expert 2007

Commented:
Do you have any code in the OnCurrent even?
And if so ... are you setting any 'default values' or otherwise ?

" nothing other than form refreshes being performed"
Can you elaborate ?
CERTIFIED EXPERT
Distinguished Expert 2017

Commented:
Refresh has the side effect of forcing the current record to be saved if it is dirty.  Always use an explicit save command if that is your intention.  The standard is DoCmd.RunCommand acCmdSaveRecord.  An alternate that circumvents a particular problem which I have never encountered is.  Me.Dirty = False.

Given the symptoms, your code is dirtying the record and the Refresh is forcing it to be saved.  I use the method suggested by als.  Setting declarative RI on the table means that regardless of what prompts the update, the database engine will enforce your rules.