Design Question: Form controls run queries at X interval

J

John

I have a form where the user assigns values to 5 combos. Each combo
represent a timed interval (e.g., 1 min, 3 min, 5 min, etc).

I have a form where a user will decide how often each of five (append)
queries will run. So, the form has five combos that each represent a
different query.

For example, the user sets combo A to "2 min". This will have the
system execute query A every 120 sec. Combo B is set to "3 min", which
will have query B executed every 180 sec.

The form interval event works fine if only one interval setting
applied to all combos---where query A, B both run at the same time.

Is there a better way to approach this?
 
J

John Spencer

Assuming that the comboboxes are set for a number of minutes and have a column
that lists the minute count

Set the timer interval to 60000 (sixty seconds)

Private Sub Form_Timer()
Static Icount As Long

Icount = Icount + 1 Count the minutes

ICount = (ICount + 1) Mod 60*24 'Reset the counter every Day

If ICount Mod ComboA = 0 then
'execute
End if

If ICount Mod ComboB = 0 then
'execute
end if


If ICount Mod ComboC = 0 then
'execute
end if

End Sub

If the comboboxes were strictly text you could use
If ICount Mod Val(ComboA) = 0 Then
'execute
End If


John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 

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