We help IT Professionals succeed at work.

Database message window

rtod2
rtod2 used Ask the Experts™
on
Access 2010

How do I set a message window to appear each time my database is opened?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016

Commented:
create an AutoExec macro

test this
ChartInd1.12.accdb

Author

Commented:
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?

Commented:
If you have a form that opens on startup, you could use the open event to display a message box.

Cheers
JC

Author

Commented:
Can you post example?

Commented:
Sure!
See attached.

Cheers
JC
openmsg.mdb

Author

Commented:
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.

Commented:
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

Author

Commented:
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

Commented:
Open the database. Select FILE tab.
Select Options and then select Current Database.
Select Display Form to any form in the DB.
This form will open when the DB opens.

Cheers
JC
openmsg2.png

Commented:
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

Author

Commented:
Excellent!