Link to home
Start Free TrialLog in
Avatar of rtod2
rtod2Flag for United States of America

asked on

Database message window

Access 2010

How do I set a message window to appear each time my database is opened?
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

create an AutoExec macro

test this
ChartInd1.12.accdb
Avatar of rtod2

ASKER

Was trying to avoid an auto-exec macro.  Is there any way to make an annotation somewhere that would be obvious, without doing an auto-exec?
If you have a form that opens on startup, you could use the open event to display a message box.

Cheers
JC
Avatar of rtod2

ASKER

Can you post example?
Sure!
See attached.

Cheers
JC
openmsg.mdb
Avatar of rtod2

ASKER

JC, Thank you.
I see your example but can't replicate in my database.  Can you use the screencast button in your reply and record a screencast?  Audio is unimportant.
Not sure about screencast (have not used it before), but here is a screen shot of the opening form in design view and code.
The highlighted code is what creates the message box.

Cheers
JC
openmsg.png
Avatar of rtod2

ASKER

JV, Thank you for the screenshot.  EE was unavailable to me for a few days.  Sorry for the delay.  With respect to your screenshot, that is helpful.  I see that you added the msg to the form so that when a person clicks the form, it comes up.  What I am unclear about is how to make it come up by default, when the database is opened.  I am using v2010.  I'd appreciate any clarity you can provide.

So far I have the following.
Option Compare Database

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click


    DoCmd.Quit

Exit_Command0_Click:
    Exit Sub

Err_Command0_Click:
    MsgBox Err.Description
    Resume Exit_Command0_Click
    
End Sub

Private Sub Form_Open(Cancel As Integer)
MsgBox "My Opening message", vbCritical, "Before you start, please read this message..."
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of JVWC
JVWC
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You only need this part of the code. (The rest was for the Quit button on the form.)

Private Sub Form_Open(Cancel As Integer)
MsgBox "My Opening message", vbCritical, "Before you start, please read this message..."
End Sub

Cheers
JC
Avatar of rtod2

ASKER

Excellent!