By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,871 Members | 2,444 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,871 IT Pros & Developers. It's quick & easy.

Capture new record event

P: n/a
In a form, when you arrive in a new record, what event is trigerred and in
which object? I can't find such an event. I need to reset a value when the
user arrives in a next record.
Thanks,
john
Feb 11 '07 #1
Share this Question
Share on Google+
10 Replies


P: n/a
I made an error in my message. 'New record' should be 'Next or Previous
record'.
john

"john" <jo**@test.comschreef in bericht
news:eq***********@textnews.wanadoo.nl...
In a form, when you arrive in a new record, what event is trigerred and in
which object? I can't find such an event. I need to reset a value when
the user arrives in a next record.
Thanks,
john

Feb 11 '07 #2

P: n/a
john wrote:
In a form, when you arrive in a new record, what event is trigerred and in
which object? I can't find such an event. I need to reset a value when the
user arrives in a next record.
Thanks,
john

If I am in a form and I press the navigation button to move to a new
record, I can check for the record's state by asking
If Me.NewRecord Then

When you go to any bound form record (form is associated with a
table/query in the recordsource), the OnCurrent event fires for each
record regardless whether it is a new or existing record.

Feb 11 '07 #3

P: n/a
john wrote:
>In a form, when you arrive in a new record, what event is trigerred and in
which object? I can't find such an event. I need to reset a value when the
user arrives in a next record.

The Current event fires whenever the current record changes.
The form's NewRecord property will indicate if the current
record is a new record.

Sub Form_Current()
If Me.NewRecord Then
'just arrived at a new record
Else
'arrived at an existing record
End If

--
Marsh
Feb 11 '07 #4

P: n/a
the OnCurrent event fires for each
Thanks, that did it, after having found the equivalent in Dutch.
john

"salad" <oi*@vinegar.comschreef in bericht
news:Y0*************@newsread3.news.pas.earthlink. net...
john wrote:
>In a form, when you arrive in a new record, what event is trigerred and
in which object? I can't find such an event. I need to reset a value
when the user arrives in a next record.
Thanks,
john
If I am in a form and I press the navigation button to move to a new
record, I can check for the record's state by asking
If Me.NewRecord Then

When you go to any bound form record (form is associated with a
table/query in the recordsource), the OnCurrent event fires for each
record regardless whether it is a new or existing record.


Feb 11 '07 #5

P: n/a
Thanks for the explanation.

I have one more additional question:
Before moving to another record or exiting the form I would like to do a
check on certain fields and prompt the user for a question (Yes/No) whether
to proceed leaving the current record or do something in code in stead and
cancel the 'leave'-action.

In which event should I do that check and how would I cancel leaving the
record?
Thanks,
john

"Marshall Barton" <ma*********@wowway.comschreef in bericht
news:g6********************************@4ax.com...
john wrote:
>>In a form, when you arrive in a new record, what event is trigerred and in
which object? I can't find such an event. I need to reset a value when
the
user arrives in a next record.


The Current event fires whenever the current record changes.
The form's NewRecord property will indicate if the current
record is a new record.

Sub Form_Current()
If Me.NewRecord Then
'just arrived at a new record
Else
'arrived at an existing record
End If

--
Marsh

Feb 11 '07 #6

P: n/a
john wrote:
Thanks for the explanation.

I have one more additional question:
Before moving to another record or exiting the form I would like to
do a check on certain fields and prompt the user for a question
(Yes/No) whether to proceed leaving the current record or do
something in code in stead and cancel the 'leave'-action.

In which event should I do that check and how would I cancel leaving
the record?
Sorry, there is no such event. The current event fires "after you arrive" at a
record. There is no corresponding event for "before you leave" a record.
However; if the checking you want to do only needs to happen on a record they
have changed then the BeforeUpdate event is what you should use and that can be
cancelled to prevent saving a record that doesn't pass all your testing.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Feb 11 '07 #7

P: n/a
Thanks. This was the idea:
1. I have about 13 fields that are used for input for an address label.
2. There's a button that automatically formats the whole label, based on the
13 fields, and stores it in an addditional field, so that user can adjust it
when that's necessary.
3. When a user changes one of the 13 fields a hidden unbound field named
'changed' is set to True.
4. When the user leaves the record I would like to tell him that the data
has changed and ask him if he wants to (re-)format the label or not.
Is that somehow possible?
john
"Rick Brandt" <ri*********@hotmail.comschreef in bericht
news:YB******************@newssvr27.news.prodigy.n et...
john wrote:
>Thanks for the explanation.

I have one more additional question:
Before moving to another record or exiting the form I would like to
do a check on certain fields and prompt the user for a question
(Yes/No) whether to proceed leaving the current record or do
something in code in stead and cancel the 'leave'-action.

In which event should I do that check and how would I cancel leaving
the record?

Sorry, there is no such event. The current event fires "after you arrive"
at a record. There is no corresponding event for "before you leave" a
record. However; if the checking you want to do only needs to happen on a
record they have changed then the BeforeUpdate event is what you should
use and that can be cancelled to prevent saving a record that doesn't pass
all your testing.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com

Feb 11 '07 #8

P: n/a
"john" <jo**@test.comwrote in message
news:eq***********@textnews.wanadoo.nl...
Thanks. This was the idea:
1. I have about 13 fields that are used for input for an address label.
2. There's a button that automatically formats the whole label, based on the
13 fields, and stores it in an addditional field, so that user can adjust it
when that's necessary.
3. When a user changes one of the 13 fields a hidden unbound field named
'changed' is set to True.
4. When the user leaves the record I would like to tell him that the data has
changed and ask him if he wants to (re-)format the label or not.
Is that somehow possible?
john
Is this a bound form? If it is then you would just use BeforeUpdate event and
eliminate the hidden control. Access already knows when a record in a bound
form has been changed.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Feb 11 '07 #9

P: n/a
john wrote:
Thanks. This was the idea:
1. I have about 13 fields that are used for input for an address label.
2. There's a button that automatically formats the whole label, based on the
13 fields, and stores it in an addditional field, so that user can adjust it
when that's necessary.
3. When a user changes one of the 13 fields a hidden unbound field named
'changed' is set to True.
4. When the user leaves the record I would like to tell him that the data
has changed and ask him if he wants to (re-)format the label or not.
Is that somehow possible?
john
Besides what others have mentioned, if the form is bound to a
table/query, you can look at the OldValue property.

Let's say when you enter the record the value is 10. You change it to
20. You could check via
If Me.Test1.Value <Me.Test1.OldValue then

Usually things are done in the form's BeforeUpdate event when you need
to stop the record updating to new values being entered by setting
Cancel to True.

>
"Rick Brandt" <ri*********@hotmail.comschreef in bericht
news:YB******************@newssvr27.news.prodigy.n et...
>>john wrote:
>>>Thanks for the explanation.

I have one more additional question:
Before moving to another record or exiting the form I would like to
do a check on certain fields and prompt the user for a question
(Yes/No) whether to proceed leaving the current record or do
something in code in stead and cancel the 'leave'-action.

In which event should I do that check and how would I cancel leaving
the record?

Sorry, there is no such event. The current event fires "after you arrive"
at a record. There is no corresponding event for "before you leave" a
record. However; if the checking you want to do only needs to happen on a
record they have changed then the BeforeUpdate event is what you should
use and that can be cancelled to prevent saving a record that doesn't pass
all your testing.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


Feb 12 '07 #10

P: n/a
Rick, Salad,
Indeed it's a bound form and I thought the form's beforeUpdate would trigger
after every field's update which is not what I want. Now it works like a
charm!
Thanks a lot,
john

"Rick Brandt" <ri*********@hotmail.comschreef in bericht
news:8h******************@newssvr27.news.prodigy.n et...
"john" <jo**@test.comwrote in message
news:eq***********@textnews.wanadoo.nl...
>Thanks. This was the idea:
1. I have about 13 fields that are used for input for an address label.
2. There's a button that automatically formats the whole label, based on
the 13 fields, and stores it in an addditional field, so that user can
adjust it when that's necessary.
3. When a user changes one of the 13 fields a hidden unbound field named
'changed' is set to True.
4. When the user leaves the record I would like to tell him that the data
has changed and ask him if he wants to (re-)format the label or not.
Is that somehow possible?
john

Is this a bound form? If it is then you would just use BeforeUpdate event
and eliminate the hidden control. Access already knows when a record in a
bound form has been changed.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com

Feb 12 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.