Manipulate MsgBox from Code

  • Thread starter Jonathan Scott via AccessMonster.com
  • Start date
J

Jonathan Scott via AccessMonster.com

Is it possible to manipulate a msgbox in code? Instead of manually clicking
"OK", I would like to do it in code. Is that possible in Access97?

Jonathan Scott
 
G

Gijs Beukenoot

Jonathan Scott via AccessMonster.com was zeer hard aan het denken :
Is it possible to manipulate a msgbox in code? Instead of manually clicking
"OK", I would like to do it in code. Is that possible in Access97?

Jonathan Scott

The default message box 'halts' all Access code so the short answer
would be no...
However, if the message is something that you've programmed, you could
write your own message-box-form and use that one instead of the
standard MsgBox
 
D

Douglas J. Steele

Gijs Beukenoot said:
Jonathan Scott via AccessMonster.com was zeer hard aan het denken :

The default message box 'halts' all Access code so the short answer would
be no...

Hate to argue, but that's not actually true. The technique outlined in
http://vb.mvps.org/samples/project.asp?id=TimedMsg works in Access as well.
The only caveat is that the message box must have a Close button on it (the
X in the upper right-hand corner of the window). It turns out that the Close
button is only active on message boxes that have a Cancel button on them, as
well as ones that only have the OK button. In other words, you cannot use
this method with a button that uses either vbAbortRetryIgnore or vbYesNo.
Note that regardless of which button is highlighted as the default button,
closing the message box this way will always return vbCancel (except when
the message box is only displaying the OK button, in which case it returns
vbOK)
 
G

Gijs Beukenoot

Douglas J. Steele formuleerde op woensdag :
Hate to argue, but that's not actually true. The technique outlined in
http://vb.mvps.org/samples/project.asp?id=TimedMsg works in Access as well.
The only caveat is that the message box must have a Close button on it (the X
in the upper right-hand corner of the window). It turns out that the Close
button is only active on message boxes that have a Cancel button on them, as
well as ones that only have the OK button. In other words, you cannot use
this method with a button that uses either vbAbortRetryIgnore or vbYesNo.
Note that regardless of which button is highlighted as the default button,
closing the message box this way will always return vbCancel (except when the
message box is only displaying the OK button, in which case it returns vbOK)

Ah! You learn something every day...
 
Top