A question about NewRecord function

  • Thread starter Thread starter joyo
  • Start date Start date
J

joyo

Hi,

I'd like to give a message box to users when they exit
from the last question in the form. I will ask whether
they want to add another new record. I have two modes, one
is EDIT and one is ADD. I used NewRecord to check these
two modes. I don't want to show this message when users
are in edit mode. At begining, I put NewRecord function in
Open event. When I open the form
(OpenForm "...",,,,acAdd), the NewRecord is 0, not "-1".
I changed "NewRcod" to load event, it changs to "-1", but
last question still is "0" for "NewRecord" function. I
have a "save" action before I get the last question.

What isnot a new record when I exit from last question. Is
the "save" action will effect it?

Thanks

joyo
 
The NewRecord property is only set to true (-1) when the
user enters new data into a blank record. As soon as a
successful save operation is carried out on that record,
the property becomes false (0) until some data is entered
into the next new record.

The place to put your message box asking about the next
record is into the AfterUpdate event of the form.
Getting to that event means the previously entered record
has been successfully saved. If the user elects to enter
another record then you can use the code line:

DoCmd.GoToRecord , , acNewRec

to steer to the new record entry buffer for the next
input. If the user says no then you can simply close the
form since no further data entry is required.

Hope that solves it for you.
Keith
 
Back
Top