Avatar of Bob Collison
Bob Collison
Flag for Canada

asked on 

Access 2016 Form Before Update Creates Blank Record

Hi Experts,

I'm having weird problem.

I have a Form bound to a table with a Primary Key whos properties include:
- Required: Yes
- Allow Zero length: Yes.
- Indexed: Yes (no Duplicates.

There are two records in the table.

The Form Before Update code checks the to see if the Primary Key [EVENT_FI_TRAN_ACCT_KEY] and if it is Null does an 'Undo' and Exit Sub.  See code below.

If Me.EVENT_FI_TRAN_ACCT_KEY & DblDblQuote & DblDblQuote = DblDblQuote & DblDblQuote Then
   'Empty Form.  No update.
   Me.F46010EventFITranRecMode = "E"   'Transaction Record Mode: E=Empty.  i.e. No Add or Update.
   Me.Undo         'Reset Form. Won't update data. Stay on same record.
   Exit Sub
   Me.F46010EventFITranRecMode = "U"   'Transaction Record Mode: U=Undetermined.
   GoTo STEP_120   'Step 120-Check If Event Finance Transaction Account Key Has Changed.
End If

When I scroll past the second record record an empty record is created in the table and I can no longer navigate either forward or backward.

There is no error produced.

I suspect that the 'freeze' issue is caused by the blank record.

How can I ensure that the blank record is not created?

Bob C.
Microsoft Access

Avatar of undefined
Last Comment
Bob Collison

8/22/2022 - Mon