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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pause code? 1

Status
Not open for further replies.

gnt

Technical User
Aug 15, 2002
94
US
I'm fairly new to vba, so this may be a rather elementary question. I am using vba to run queries in another access database, but I want to change the visibility of controls in the current database first. My code is as follows:
-------------------------
If optfrmCompany.Value = 1 Then
optfrmCompany.Visible = False
lblWait.Visible = True
Dim db As Database
Dim qyDel As QueryDef
Dim qyIns As QueryDef
Dim qyUpd As QueryDef
Set db = DBEngine(0).OpenDatabase....
--------------------------
The problem is, Access switches databases before it hides 'optfrmCompany' and displays 'lblWait'. Is there any way to pause while it finishes these commands before defining the new database?
Thanks-
 
Have a look at 'DoEvents' and 'Wait' VBA commands. Regards
BrianB
** Let us know if you get something that works !
================================
 
I personaly don't like do events... it does more then one would think...

It sounds like these controls you reference are on a form...

try
me.repaint
in this code... it repaint's the screan... i think that's what you want...

--James
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Repaint works beautifully!
Thanks so much!
 
no problem... i prafer not to use do events because it checks the thread que for the entire computer and realy slows down a program...

Don't forget to give star's to people that provide helpfull information.

--James
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top