Recordset Changed

G

Graham

Hi,

Thanks in advanced for your help.


2 questions

1) On a form what is the best way to check to see if any
one of the fields have been changed on saving or moving
to another record. Ps I need to write to another file at
this stage.

2) Need to write to same file (As above) if a new record
has been added but only at the save stage.

Many Thanks

Graham
 
T

tina

hmmm, you could use the form's AfterUpdate event for both new and existing
records. the event is only triggered when new data is saved to an existing
record, or when a new record is saved - so you don't have to write code to
check for those circumstances. just save the record, by 1) clicking
Records|Save Record on the form menu bar, or 2) moving to another record, or
3) closing the form. in other words, any action that moves you off of the
current record will automatically save any new data in the new or existing
record - thereby triggering the form's AfterUpdate event, and any code added
to the event.

hth
 
G

Graham

Tina,

Thanks very very much so well explained with no doubt for
any error and exactly what i wanted.

Graham
 
N

Neil

Graham,

As a follow on from Tina,

If you need to distinguish between adding a new record and updating a record
then using the BeforeUpdate event will do exactly the same thing as the
AfterUpdate event except the forms NewRecord property will be True if you
are adding a record and False if a record is being updated.

e.g.

Private Sub Form_BeforeUpdate(Cancel As Integer)

If Me.NewRecord Then
' Adding a record
Else
' Updating a record
End If

End Sub

HTH,

Neil.
 

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