Custom MsgBox

  • Thread starter Thread starter Dom
  • Start date Start date
D

Dom

Hello All,

I have decide to create a custom MsbBox; I really
dislike the default MsgBox. However, I'm having
dificulties trying to figure out how obtain the response
value and continue with code in calling form.

OBJECTS & CODE ============================================

'''Table used to store all messages
Table = tblCustomMsgBox
sysMsgID = PrimaryKey
MsgBarTitle
MsgToDisplay

'''Form used as a custom MsgBox
Form = frmCustomMsgBox
txtSysMsgID
txtMsgBarTitle
txtMsgToDisplay
optMsgResponse = acOptionGroup

'''Calls CustomMsgBox from anywhere
Module = mdCustomMsgBox
Sub srOpenCustomMsgBox(stCustomMsgID As String)

Dim stCustomMsgBoxName As String
stCustomMsgBoxName = "frmCustomMsgBox"
If IsLoaded(stCustomMsgBoxName) Then
DoCmd.Close acForm,stCustomMsgBoxName,,acSaveNo
Else
DoCmd.OpenForm stCustomMsgBoxName, acNormal, ,
stCustomMsgID
End Sub

'''Open the form with it's MsgID # to ask if the user
'''wishes to exit or cancel exit.

Private Sub cmdExit_Click()
Call mdCustomMsgBox.srOpenCustomMsgBox
("[sysMsgID] = 1")
End Sub

===========================================================

This is my problem. If I do an If...Else...EndIf statement
after the Call of the module the code keeps on executing
with out the user selecting a yes or no. How can I make
the form wait until a value has been choosen. Is there
anyway to do this or am I going about this the wrong way ?

Any help is greatly appreciated, however, please keep in
mind I'm learning as I go. Thaks all.

Dominick
(e-mail address removed)
 
Dom said:
Hello All,

I have decide to create a custom MsbBox; I really
dislike the default MsgBox. However, I'm having
dificulties trying to figure out how obtain the response
value and continue with code in calling form.

If you open the form with the acDialog option of DoCmd.OpenForm then your
code will pause until the form is either closed or hidden. I usually have
my [OK] button hide the form so my code can still pull values from the
hidden form before closing it and have my [Cancel] button close the form
entirely. In the line after opening the form I test to see if the form is
still open (and hidden) or closed. That way I can tell whether the user
pressed [Cancel] or [OK].
 
Back
Top