How to stop message box appears after the database is closed

Apple08

Active Member
Joined
Nov 1, 2014
Messages
450
Hi All

I have created the macros below and the message box appears twice while the form is loaded and also after the database is closed. I only want the message box to appear once when the form is load and once user has selected 'OK' then the message box should be disappeared and no longer required. Please could anyone help to point out my mistake:

VBA Code:
Private Sub Form_Load()

Application.RunCommand acCmdAppMaximize

DoCmd.ShowToolbar "Ribbon", acToolbarNo

Call SetEnabledState(False)

Call Menu_Load

Me.lblWelcome.Caption = "User: " & strPeopleName

' Sets the time in the 'userUseRecord' table when the user logs into the database
Call setLogin

'Restricts access to the database to LTI staff members
Call LTIstaffPermission

'Sets users editing permissions
Call setUsersEditingPermissions

Call Msg_Box

End Sub

Private Sub Msg_Box()

MsgBox "Please note the form is no longer in use.", vbInformation, "Important Information"

End Sub
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Put a break point at the start of the code. Do whatever it is you're doing to run it and watch what happens line by line (F8). I see nothing in that code that should present a message box more than once. It is probably one of the many procedures that you're branching off to that's doing it.
 
Upvote 0
Agree with the above. Also, you might get this behavior if the form is actually loaded more than once.
 
Upvote 0
PMFJI,

Never been a fan of showing a user something, then saying they cannot use it?
I'd prefer to not show it in the first place?
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,423
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top