Close Message box

L

LG

I have created a message box with the following:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If ([REASON1] = 1 And [PLATFORM] = "QL" And [CLIENT_CARRIER_CODE] = "lzboy")
Then
MsgBox "Please check elegibility on RxClaim for DOF!"
Me.PLATFORM.SetFocus '<---Assumption: control name is 'Platform"
Cancel = True
End If
ExitProc:
Exit Sub
ProcError:
MsgBox "Error" & Err.Number & ":" & Err.Description, vbCritical, "Error in
procedure Form_BeforeUpdate..."
Resume ExitProc
End Sub
What this does is if Reason1 =1, Client is LZBOY, and platform is QL a
message box will appear to please check carrier.
How do I get the message box to close once the processor presses ok. It is
just a warning to look for it not necessarily that if must be changed.
Thank you
 
J

John W. Vinson

How do I get the message box to close once the processor presses ok. It is
just a warning to look for it not necessarily that if must be changed.
Thank you

Don't set the Cancel property, or at least give the user a chance.

It may help to use the other syntax of the MsgBox: use it as a function which
returns a value, rather than as a command. Try:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim iAns As Integer ' define a variable to catch the user's response
If ([REASON1] = 1 And [PLATFORM] = "QL" And [CLIENT_CARRIER_CODE] = "lzboy") _
Then
iAns = MsgBox("Please check elegibility on RxClaim for DOF!" _
& vbCrLf & "Click OK to load this anyway, Cancel to reselect Platform", _
vbOKCancel)
If iAns = vbCancel Then
Me.PLATFORM.SetFocus '<---Assumption: control name is 'Platform"
Cancel = True
Else ' user selected OK, don't do anything
End If
ExitProc:
Exit Sub
ProcError:
MsgBox "Error" & Err.Number & ":" & Err.Description, vbCritical, "Error in
procedure Form_BeforeUpdate..."
Resume ExitProc
End Sub
 

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

Top