Hourglass and adding results to text box

M

Mark

Hello all,

I have two issues with this code that I am running.

1st, Once I click the button I expect the “DoCmd.Hourglass True†to turn on
as soon as I hit the button, but it does not. It takes up to 5 to 10 seconds
for it to come on, even though it’s the first line in my code. Is there a
way to make this come on instantly?

2nd, I have my txResults running three times to have it format the way I
want it, but for some reason it just runs the first then after all is done it
runs the next two lines, why?

Example of output: (Shorten for read ease)

Does this first:
Container: 000698080500 Nest to: 000866568829 OP Code:
Container: 000698080500 Nest to: 000843219854 OP Code:

Then does this after it is finish looping and finds EOF.

Container: 000698080500 Nest to: 000866568829 OP Code:
---------------------------------------------------------------------------

Container: 000698080500 Nest to: 000843219854 OP Code:
---------------------------------------------------------------------------

Looks like to me it would format this correctly at the start.

Dim db As Database
Dim rs As Recordset
Dim vSql As String
Dim vLkUp

DoCmd.Hourglass True

vLkUp = txLkUp
txResults = ""
txResults.Requery

vSql = "SELECT CONT, NEST_TO_CONT, OP_CODE, TRANS_STT, AREA_ID,
STORE_NUM, HOST_LOC, LOGON_ID, DTIMEMOD, WORK_REQ_ID, PARENT_REF_NUM FROM
VIAWARE_WCS_TO_VIA_T WHERE """ & vLkUp & """ = cont"

Set db = CurrentDb()
Set rs = db.OpenRecordset(vSql)

Do While Not rs.EOF

txResults = txResults & "Container: " & rs![CONT] & " Nest to: " &
rs![nest_to_cont] & " OP Code: " & rs![op_code] & " Trans: " & rs![trans_stt]
& " Area: " & rs![area_id] & " Store #: " & rs![store_num] & " Location: " &
rs![host_loc] & " User: " & rs![Logon_id] & " Date Modified: " &
rs![dtimemod] & " Work Req: " & rs![work_req_id] & " Parent Ref: " &
rs![parent_ref_num] & vbCrLf

txResults = txResults & "------------------------------------------------" &
vbCrLf

txResults = txResults & vbCrLf

rs.MoveNext

Loop

rs.Close
db.Close

DoCmd.Hourglass False

Exit_btLkUp_Click:

Exit Sub


Err_btLkUp_Click:
MsgBox Err.Description
Resume Exit_btLkUp_Click

End Sub
 
M

Mark

Please disregaurd, I had a previous copy of this code that was running on the
after change that was causing the errors.
 

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