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

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
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,224,526
Messages
6,179,322
Members
452,906
Latest member
Belthazar

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