
halting VB program execution until OS finishes
Hi,
I'm trying to get my VB program to wait until a previous
command has finished executing before it goes ahead and
executes the next command line. It's running within Access
and it deals with retrieving records from a database
through sql statememnts.
Here's the portion of the code and I've marked where the
program halting needs to happen:
Set db = CurrentDb()
sql = "SELECT DocumentID, DocumentName FROM
tblMyDocuments"
sql = sql & " WHERE Current = true;"
Set rs = db.OpenRecordset(sql, dbOpenSnapshot)
(!!!!!it is here that I need to have a command
that halts the program execution until all records are
placed in the recordset!!!!!)
If Not rs.EOF Then
rs.MoveFirst
counter = 0
While counter < rs.RecordCount
'Preview/Print Document command here
etc, etc.
Does anyone have any idea as to what I can do here??
Greately appreciate your help,
Ian.