where is record-change-event??

M

mg

I want things to happen each time a record is loaded onto the form.but i
cant find the event to place my code into---

eg//
when form loads, it loads record#1, and i want certain things to happen
when user clicks on the access controls to move forward or backward through
the recordset, i want certain things to happen when those records are loaded
onto the form

i dont see where the event is when this occurs.. i tried onpaint, but is
occurs way too often.
 
B

Bill

The OnChange Event pertains to data bound to
a form's controls collection. It does not pertain
to scroll bars and the like.

If you post the specifics of what elements you
want to effect with a user action, you'll have to
tell us what those are and how you want either
data and their controls to behave.

Bill
 
R

RoyVidar

mg said:
I want things to happen each time a record is loaded onto the
form.but i cant find the event to place my code into---

eg//
when form loads, it loads record#1, and i want certain things to
happen
when user clicks on the access controls to move forward or backward
through the recordset, i want certain things to happen when those
records are loaded onto the form

i dont see where the event is when this occurs.. i tried onpaint,
but is occurs way too often.

The On Current event of the form occurs each time you move to a
record.
 
L

Linq Adams via AccessMonster.com

As Roy has said, the event you're looking for is the Form_Current event.

If you want something done ***every*** time you move to a different record,
the code would look like this:

Private Sub Form_Current()
'Place code to be executed here
End Sub

But you have to be careful in doing this, because this event also fires when
you go to enter a new record, and some things commonly done in this manner
should only be done for existing records, ones that already have data in them.


To only carry out an action if the record is an existing record, you'd use
something like this:

Private Sub Form_Current()
If Not Me.NewRecord Then
'Place code to be executed here for existing records only
End If
End Sub

or for actions to be carried out, depending on whether or not the record is
new or existing:

Private Sub Form_Current()
If Not Me.NewRecord Then
'Place code to be executed here for existing records
Else
'Place code to be executed here for new records
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top