View Full Version : Test for New Record


aimeepeter
10-07-2008, 07:05 AM
What is the code to test for a new record?
(I have code that runs on the On Current event of my form, but I don't want the code to run if it is a new record that has not been updated yet because it is creating multiple unwanted blank records.)

Thanks!

ajetrumpet
10-07-2008, 07:11 AM
the code to test is:if me.newrecordbut unfortunately, if the code you want to suppress is on the CURRENT event, you've already started running it before you can check for a new record!

you need a way to check if an ACTION that the user is going for BEFORE they get to the new record will result in a new record itself (sort of like pushing a button that says "create new record").

wazz
10-08-2008, 07:36 AM
possibly a variation on:
if me.newrecord and me.dirty then 'form is edited but not saved

as aje suggests, put your code on the before update, after update or after insert event.