Pause for 3 seconds....

smaumau

Registered User.
Local time
Today, 00:47
Joined
Feb 23, 2006
Messages
32
I would like to create an AutoExec macro to display a picture for 3 seconds or so when my database is opened. The best way I was able to come up with was to put the picture on a form and have a macro that opens it. How can I have the macro wait three seconds after the form is opened prior to closing it?
 
In the on timer event of the picture form

Open your main form close your picture form

In the timer interval event type 2000 if the picture form doesn't display for long enough just increas ethe timer interval
 
Searching the forum is a great way to discover and learn the answers to your Access programming questions.

Pause()

:cool:
 
I would like to have the VBA module code below pause and then close a report. As is, I am getting an error message, when compiling, that "Constants, fixed-length strings, arrays, user-defined types and Declare statements not allowed as Public members of object modules". I guess I can split the Declaration Function and the subroutine into two scripts, and have the pause function call the close subroutine, right? Can someone give guidance please?

Code:

Option Compare Database
Declare Function Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Report_NoData(Cancel As Integer)
On Error GoTo HandleErr
Sleep (5000)
DoCmd.Close
ExitHere:
Exit Sub
HandleErr:
MsgBox "Error number " & Err.Number & ": " & Err.Description
Resume ExitHere
End Sub
 
I think it's trying to tell you that this:

Declare Function Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Has to go in a stand alone module.

???
 
I think it's trying to tell you that this:

Declare Function Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Has to go in a stand alone module.

???
I think you are right...Do you know how I can then call the second module (to close the report) from the first module (above), since I will call this module from the Report property "On No Data"?

Thanks
 
I have found the best way is to change the start up options to open a form (Welcome Screen) and run an OnTimer event to open your main menu and close the welcome screen. I had to play with the time setting to get the time right though. Try searching help for "OnTimer" for more info
 
bg

Option Compare Database
Declare Function Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

just put this bit in a separate module, instead of where it is

then your code (sleep function) should work without further amendment - global code modules have global project scope, so you shouldn't need to do anything else.

Thats what Ken meant earlier
 

Users who are viewing this thread

Back
Top Bottom