Originally Posted by
stephen c
Thank you guys for all of your help. Now, the delay works! (Andy, I didn't add prtsafe yet, because I'm not sure exactly where. I did so in the declarations and got error)
Now, the odd thing is that the thing I'm waiting on doesn't execute until AFTER the delay! See full code below. What is supposed to happen is the program checks a record for the presence of the checkbox=true. If so, it incriments i, displays the new value in the textbox checkqty, then a delay, then on to the next record to check for i. I'm using the msgbox just as a test feature. I know this is a ridiculous program. In the future, "check for i" will be replaced with a call to an outside JAR, so this is just for mock-up.
I have no idea why the value would wait until after the delay to display! Thanks, folks!
--------------------
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("SELECT * FROM consolidatorlisttable;")
Dim i As Integer
Dim starttime As Date
i = 0
rs.MoveFirst
Do While Not rs.EOF And Not rs.BOF
If rs!portalsend = True Then i = i + 1
rs.MoveNext
Loop
Me.checkqty = i 'displays the value in i in the textbox checkqty
docmd.requery "checkqty" might help
Call Sleep(15000)
' starttime = Now
'Do While DateDiff("s", starttime, Now) < 60
'Loop
MsgBox "test message"
rs.Close
Set rs = Nothing