User input disable msg box

T

Tina Hudson

Good afternoon,

I have a form that adds data to a table and after user clicks on the cmdOK
button, a msgbox appears that asks them a yes/no question.

After a while, I expect the user to get tired of this question, and will
want it to go away.

Is there anyway I can programmatically allow the user to disable a message
box?
 
J

JimBurke via AccessMonster.com

I guess the real question in this instance is, why is the message box being
displayed? Just because they are tired of seeing it doesn't mean it's not
necessary. It really depends on why you're asking them the question in the
first place.

In my application I have a table that keeps track of various application
parameters that control whether certain things are being used by the
cusotmer or not, whether different prompts are given or not, etc. We have
different functions available to different customers. You could have a table
like that that has a boolean field called, say, DisplayIrritatingMessageBox
(might not want to use that exact name!). I wouldn't think you would ever
want the user to have control over whether something is displayed or not -
you should probably do that yourself. But if you have that parameter in place,
then at some point in the future if you know you want to stop displaying it
you can just change that parameter from True to False without having to make
any changes to the app. And if you ever decide in the future that you need it
again, just change the setting. This table would have to go in your DB that
has the tables, not in the appl DB (assuming you have a split DB). This
wouldn't work in a DB that isn't split.

What I do with these settings is create Public variables for each of them in
a separate code module. When the application starts I read these parameters
in from my table and set the various variables that correspond to them. Then,
in your case, where that message is displayed, you'd have an IF...

If DisplayIrritatingMessageBox Then
msgbox "blah blah ....
Else
whatever...
ENd If
 
T

Tina Hudson

Thanks Jim. I'm not sure I want to go to all that trouble to allow the user
to remove future instances of the message box. I am, of course, assuming
that the user is actually reading the question. In fact, they most likely
aren't. At least not enough to memorize the question. Not my users. lol

I really just wanted to know if it could be done. There is another app at
my office that we use (I'm not the administrator of that app) that allows a
user to turn off message boxes that pop up. I was a bit jealous!

Anyway, I'll print your answer and maybe in the future when I get feedback
that the msgbox is irritating, I'll revisit this issue.
 
J

JimBurke via AccessMonster.com

There has to be some way they did that behind the scenes. I don't think
there's any way to 'magically' turn off a message - I would think they had to
have some kind of setting that remembered whether or not they wanted it
turned on. How would the application remember that the last time they were in
it they said to turn it off? Or know to show it if it wasn't turned off? If
you wanted the user to control it you could give them a Yes, No, Cancel
message box, where Cancel translates to 'don't show this msg any more'. But
this leaves no way of ever turning it back on again. And even if you did that,
you'd have to have some way of remembering whether it's 'on' or 'off'.

Tina said:
Thanks Jim. I'm not sure I want to go to all that trouble to allow the user
to remove future instances of the message box. I am, of course, assuming
that the user is actually reading the question. In fact, they most likely
aren't. At least not enough to memorize the question. Not my users. lol

I really just wanted to know if it could be done. There is another app at
my office that we use (I'm not the administrator of that app) that allows a
user to turn off message boxes that pop up. I was a bit jealous!

Anyway, I'll print your answer and maybe in the future when I get feedback
that the msgbox is irritating, I'll revisit this issue.
I guess the real question in this instance is, why is the message box being
displayed? Just because they are tired of seeing it doesn't mean it's not
[quoted text clipped - 37 lines]
 
F

fredg

Good afternoon,

I have a form that adds data to a table and after user clicks on the cmdOK
button, a msgbox appears that asks them a yes/no question.

After a while, I expect the user to get tired of this question, and will
want it to go away.

Is there anyway I can programmatically allow the user to disable a message
box?

Why a yes/no question when the only thing you are doing with the
MsgBox is displaying information?

Here is a very simple and quick method, but not using the built-in
MsgBox.
Just create your own form to be used as a message form.
Add a label with whatever text you wish to display.
Add a Command button with code to close this form.
DoCmd.Close acForm, Me.Name
Add a check box to this form.
Code the Check Box AfterUpdate event:
CurrentDb.Execute "Update tblHideMessage Set tblHideMessage.[HideOK] =
" & Me.[CheckBoxName], dbFailOnError
As the label caption for this check box write:
"Do not show this message again."
Code the form's Open event:
If DSum("[HideOK]","tblHideMessage") = -1 then
Cancel = true
End If

Name this form "frmMessage".

Add a table with just one field to your database.
Table name "tblHideMessage"
Field Name "HideOK" Yes/no datatype
Set the field's value to No (0).

Code the cmdOK command button that you are using to display this
message instead of the MsgBox:

On Error GoTo Err_Handler
DoCmd.OpenForm "frmMessage", , , , , acDialog
Exit_Sub:
Exit Sub
Err_Handler:
If Err = 2501 then
Else
MsgBox "Error: " & "Err.Number & " " & err.description
End If
Resume Exit_Sub

When the code runs to display the message, if the Check box has not
been checked the form will open and wait for the user to click on it's
command button before any further processing is done.
If the [HideOK] field has been checked, the form will not open.

Any time you wish to start re-showing the message form, simply change
the value of the [HideOK] field (manually or by code) back to 0.

Alternatively, you can look at how Microsoft hides a form by examining
the Startup form and it's code in the Northwind sample database that
ships with Access.
 

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

Similar Threads


Top