Calling a Macro Based on QUERY Result

R

Richard C Buchanan

Can anyone tell me how to build a query THAT, depending on result ... runs a
named macro?
AND run's the QUERY every 'n' minutes!


You see ... I need to examine a specific table. If it contains ONE data
record ... I need to RUN a macro that reacts to the contents of that record.

I need to perform this query every 3 minutes or so.



ANY IDEAS!? I think ONTIMER might help ... but I'm a very-newbie and don't
see the relationship with a form!
UNLESS I can auto-refresh the form ... !?

Thanks if you can help!
Richard

richard @ rcbuchanan . com
 
A

Arvin Meyer

Use the form's OnTimer event to run code every 3 minutes (180,000
milliseconds) that does a DCount of the query or RecordCount of a recordset
based on the query. Something like (aircode):

Sub Form_Timer()
If DCount("ID", "YourQuery") = 1 Then
'...Do something
End If
End Sub

Set the TimerInterval to 180000
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 

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