close form automatically after say 2 second

  • Thread starter Thread starter Song Su
  • Start date Start date
S

Song Su

I guess I cannot close msgbox after predetermined time in code. So I want to
use a form to display message and close automatically in 2 seconds. How to
do that?

Thanks.
 
These code works. How to supply message to the form in code?

Option Compare Database
Option Explicit

Private Sub Form_Open(Cancel As Integer)

Me.TimerInterval = 2000

End Sub

Private Sub Form_Timer()
DoCmd.Close acForm, "Form1"
End Sub
 
If you supply a value for the OpenArgs when calling the form, you can set a
textbox to equal the value of OpenArgs.

Code to call form:
DoCmd.OpenForm "Form1",,,,,, "Message to display"

Then in the OnOpen event of Form1:
Me.Field = Me.OpenArgs

Steve
 
Thank you. I'll try that.

SteveM said:
If you supply a value for the OpenArgs when calling the form, you can set
a
textbox to equal the value of OpenArgs.

Code to call form:
DoCmd.OpenForm "Form1",,,,,, "Message to display"

Then in the OnOpen event of Form1:
Me.Field = Me.OpenArgs

Steve
 

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

Back
Top