In VBA, how can I check if the current form record is a new recor.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
When you click the Next button in a form while you've selected the last
record, you can enter a new record.
In VBA, I would like to run some script when this event occurs.
How can I check that the selected record is a new record, when you click the
Next button?

H
 
You can use form's Current event to check for .NewRecord property

If me.NewRecord then
'now we at new record
end if
 
Great, it works!
Thanx a lot Alex

Greetings
H

Alex Dybenko said:
You can use form's Current event to check for .NewRecord property

If me.NewRecord then
'now we at new record
end if
 
Hi Alex, thank you for the answer.

The problem is that I don't have a new record - it's existing record, in my
case it's a date field. I change this field relationed with a text box,
calling a calendar form wich put the new date value in the text box. I need
that the event OnChange to start to do something in another field
relationated with this new data value.
The event OnChange "must" starts, becouse it is su purpose, but it do not.
In another language like Delphi this works correctly.
I think, that this is a big problem of Access. Does anybody can confirm the
same?
I try it at 2 computers and I think it is not local problem.
 
Hi,
as I understand - you change data in textbox, by assigning it a value from
code. In this case Change event should not fire, by design I think. What you
can do is to "raise" this event in a code where you change value of textbox,
calling corresponding procedure

HTH
 
Yes, that si what I want to do.
But I can't "raise" the event from the code, becouse first I need to get the
date value from another Form(Calendar), wich is raised from here. This
Calendar Form puts the date value in the textbox.... and the textbox OnChange
event do not starts!I need first to finish the Calendar Form and then raise
the OnChange event, but the actual event finish first, making raise the
OnChange event, yes, and starts Calendar Form then.
 
you can make a public sub to call from calendar form
i normally add RaiseFormEvent sub to such forms, which accept event name,
and which i always call after calendar date selected.

HTH
 
Back
Top