Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Caption is lagging execution of code.

Status
Not open for further replies.
Feb 23, 2004
71
US
I've looked for the answer to this but couldn't find anything (I may not be looking for the correct keywords.)

This is a two-part question

Using Access 97:

1) When I run this in a form I get a caption that does not match what is going on in the database. (i.e., Caption is lagging execution of code.) I often get only one text message before the code stops running.

I want to monitor and time (roughly - so I don't need code) each step but the caption is not getting updated as each step starts. Should I put a 'pause for 5 seconds' or dummy loop in between each process? It can't be a request for user input (e.g., "Press Enter to continue") because this also has to run unattended or in batch mode.

2) If the app loses focus (e.g., I go to another application or my machine locks after two minutes (for security reasons) the message disappears altogether until the next message is displayed. Is there a way to keep the caption displayed on the screen? (When I come back to Access I have no way of knowing what step is being run.)

The code (using Access 97) is very simple.

I set the caption then run the query.
DoCmd.SetWarnings False

lblStatus.Caption = "1 - Open Claims mktbl"
DoCmd.OpenQuery "1 - Open Claims mktbl", acViewNormal

lblStatus.Caption = "2 - Claim+POA mktbl"
DoCmd.OpenQuery "2 - Claim+POA mktbl", acViewNormal

lblStatus.Caption = "3 - ClaimWithPOA updt"
DoCmd.OpenQuery "3 - ClaimWithPOA updt", acViewNormal

lblStatus.Caption = "Done"

DoCmd.SetWarnings True
DoCmd.Quit

thanks,
mike
 
I'm experimenting with "repaint". will post results shortly.
 
Have a look at the DoEvents function.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
This solved problem #1:

lblStatus.Caption = "2 - Claim+POA mktbl"
Form_AutoForm.Repaint 'update caption before running query
DoCmd.OpenQuery "2 - Claim+POA mktbl", acViewNormal


Have not solved problem #2.
PHV - I've looked at DoEvent but can't figure out if/how this will resolve my dilemma. Can you provide some sample code?

mike
 
How are ya madelca100 . . .

Did you try [blue]PHV's[/blue] suggestion? [blue]DoEvents[/blue] allows time for the caption to update, where as [blue]Refresh[/blue] simply repaints the screen. With a fast enough processor you'd still miss updating! . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top