Connecting Tech Pros Worldwide Forums | Help | Site Map

What event occurs just before a record is written to table?

DavidGeorge
Guest
 
Posts: n/a
#1: Nov 13 '05
I have 2 subforms, neither of which is linked to the main form. Of the
left of my form is a subform with a list of organisations and on the
right is a subform with details of the organisation currently selected
on the left.
Having added data to the right-hand subform, when I click on the
left-hand form (to select a different organisation) the new data (on
the right-hand subform) is written to the database, but I need to trap
the process, immediately before the write, to add some calculated data
to the record.
I've tried every reasonable-sounding event to trigger this process
without luck so far. Can anyone help? (does anyone understand what I
am asking?)


Douglas J. Steele
Guest
 
Posts: n/a
#2: Nov 13 '05

re: What event occurs just before a record is written to table?


Should be the form's BeforeInsert event.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"DavidGeorge" <david229099@hotmail.com> wrote in message
news:1108194087.450842.316530@o13g2000cwo.googlegr oups.com...[color=blue]
>I have 2 subforms, neither of which is linked to the main form. Of the
> left of my form is a subform with a list of organisations and on the
> right is a subform with details of the organisation currently selected
> on the left.
> Having added data to the right-hand subform, when I click on the
> left-hand form (to select a different organisation) the new data (on
> the right-hand subform) is written to the database, but I need to trap
> the process, immediately before the write, to add some calculated data
> to the record.
> I've tried every reasonable-sounding event to trigger this process
> without luck so far. Can anyone help? (does anyone understand what I
> am asking?)
>[/color]


Rick Brandt
Guest
 
Posts: n/a
#3: Nov 13 '05

re: What event occurs just before a record is written to table?


DavidGeorge wrote:[color=blue]
> I have 2 subforms, neither of which is linked to the main form. Of
> the left of my form is a subform with a list of organisations and on
> the right is a subform with details of the organisation currently
> selected on the left.
> Having added data to the right-hand subform, when I click on the
> left-hand form (to select a different organisation) the new data (on
> the right-hand subform) is written to the database, but I need to trap
> the process, immediately before the write, to add some calculated data
> to the record.
> I've tried every reasonable-sounding event to trigger this process
> without luck so far. Can anyone help? (does anyone understand what
> I am asking?)[/color]

BeforeUpdate. BeforeInsert fires as soon as you "dirty" the record which could
be quite a while before the record is committed. You could dirty a record and
then go to lunch saving the record when you get back.

In addition, there are circumstances where BeforeInsert NEVER fires when
inserting records so it's unreliable.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


DavidGeorge
Guest
 
Posts: n/a
#4: Nov 13 '05

re: What event occurs just before a record is written to table?


Thanks Doug and Rick. I deleted my original question because I
discovered that OnDirty was in fact working. It didn't appear to be
working because a function I was using to populate one of the fields
suddenly and inexpicably started to return null (see 'Simple function
sometimes works ... sometimes doesn't ? '). You don't by any chance
have any ideas concerning that question do you?

Closed Thread