On Open event

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

Guest

I have a macro cariies out 2 "delete & append" queries on two separate tables. The tables that the action queries amend are then linked to various other tables, upon which a query is based. This query provides a recordset that is displayed in a form

I wanted the action query to occur in the On Open event of the form so that the two tables are up-to-date when the form is opened. However, I seem to be getting two additional records appearing in the form which are effectively copies of another record but showing data from the two tables above as "deleted". However, if I run the macro separately, before opening the form i.e. not using the On Open event, the recordset is perfect

Anybody know why?
 
This is a timing problem. When you run an action query from code it does
not wait for the action to complete before finishing the rest of the code.
By putting this in the On Open event, the form is probably accessing the
information before the action qeuries are finihsed, which would explain the
duplicates on screen and "deleted being shown".

Kelvin

Andrew said:
I have a macro cariies out 2 "delete & append" queries on two separate
tables. The tables that the action queries amend are then linked to various
other tables, upon which a query is based. This query provides a recordset
that is displayed in a form.
I wanted the action query to occur in the On Open event of the form so
that the two tables are up-to-date when the form is opened. However, I seem
to be getting two additional records appearing in the form which are
effectively copies of another record but showing data from the two tables
above as "deleted". However, if I run the macro separately, before opening
the form i.e. not using the On Open event, the recordset is perfect.
 
Back
Top