[AccessD] Timer Routine needed - or some other solution?

Jim Dettman jimdettman at verizon.net
Wed May 5 12:42:00 CDT 2010


Rocky,

  You can use the function below, but I generally find anything that is time
based is always problematic.

Jim.

Public Function Wait(intSeconds As Integer) As Integer

    Dim datCurDateTime As Date
10  datCurDateTime = Now

20  Do Until DateDiff("s", datCurDateTime, Now) > intSeconds
30      DoEvents
40  Loop

End Function

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Wednesday, May 05, 2010 12:16 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Timer Routine needed - or some other solution?

Dear List:

The problem is that mdb 1 calls a module in mdb 2 which prints 4-5 reports -
to a network printer.  The user wants those reports to come out in a
specific order, so the module calls them in that specific order.  But when
the reports print, they come out in a different order - random or scrambled
according to the user.

So user asks me to write some kind of timer routine that would delay the
call to the next report by 30 seconds.  Now the calls are in a module so I
can't use the timer event.  A nice tight loop checking the computer's clock
would work except it might suck up so many machine cycles the reports might
not get printed.  In any event, not much else would go on in that machine
while it was running the loop.

I asked him to take the printer off line and look at the queue to see what
order the reports are in there, but can't get him to do that.  

Asked him to hook up a local printer and see how the reports come out and,
if scrambled, take it off line and see what the queue looks like.  But he's
really insistent that the first thing we try is to program our way into an
orderly report printing.

I did get him to concede that he could put the report printing code in a
module behind a form in which I could embed a timer event.  

So, what to do?  I'm looking at a minimum for a way to separate the printing
of the reports in the module (he tried DoEvents but that didn't help) by 30
seconds or so.  If by some miracle that works, then problem solved.  If it
fails then maybe I can get him to look at another approach.

MTIA

Rocky





More information about the AccessD mailing list