ReQuery

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

Guest

Hi,

When the underlying data for a form is changed is any kind of event triggered?

I would like the form to automatically perform a requery after the table
data has changed if possible.


Regards,
Ron.
 
Hi Ron

I think you mean - if the data the form is based on has changed through
another data update - i.e. not from the form itself?

This is tricky to do, as there are no Access events that I know of.

Access itself doesn't implement any way of taking an action when one of
its own tables is updated - the only way you could do this in Access
would be clunky:

- Create a "date/time updated" column in the table
- You'd have to enforce a rule that ANY operation on the table, whether
through forms, user input directly to the table (if this is allowed) or
running of UPDATE/INSERT/DELETE queries must updated this column.
- The form could then periodically check the table for any rows WHERE
DateUpdated>Now(), and requery if there are any. It might have to
ignore updates done through itself (in which Access automatically
requeries the data), which could be even more tricky to implement.

If you're using SQL as a back-end, you could set the UPDATE, INSERT and
DELETE triggers on the table to set some kind of value somewhere - e.g.
update a "date last updated" in a one-row table. The form could then
look at this value instead. The SQL version at least has the advantage
that _all_ changes to the table, by whatever method, would trigger the
requery.

Probably the easiest thing to do would be to put a Requery on the
Activate event (in case user has been in another Access window that
might have affected the data), and on the Timer event - set the
Timerinterval to some realistic value (ms), depending on how often the
data tends to be updated in your particular setup.

cheers


Seb
 
Cheers Seb,

You've reinforced my feelings that I need to migrate the DB to SQL Server
(well, MSDE). Generally, Jet seems a to have some disfunctionality generally!

I'm going to move it over next week I think, I've got too much going on at
the front that should be happening at the back anyway.


Cheers matey,
Ron.
 
Back
Top