Message box to appear twice!

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

I already have one message to appear but if yes is selected i want this new
message box to show ....Thanks Bob
Private Sub cmdDistributeAllInvoices_Click()
Dim nRtnValue As Integer

nRtnValue = MsgBox("Are you sure you want to Distrubte All Invoices ?",
vbCritical + vbYesNo + vbDefaultButton2, "Distribute all Invoices")
If nRtnValue = vbYes Then
DoCmd.Hourglass True
****MsgBox(" All these Invoices will have Invoice Numbers") Yes No****
subSetInvoiceValues
Application.SysCmd acSysCmdSetStatus, "Process is completed."
Application.SysCmd acSysCmdClearStatus

DoCmd.Hourglass False
End If
End Sub







..........Jenny Vance
 
Bob,

Sorry, I don't understand what your problem is.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
After I click yes on the first message box I want another box to pop up with
a warning of what is going to happen..Thanks Bob
 
Bob,

You already had it, so I fail to understand why you couldn't have done it
yourself.

Private Sub cmdDistributeAllInvoices_Click()
Dim nRtnValue As Integer

nRtnValue = MsgBox("Are you sure you want to Distribute All Invoices?",
_
vbCritical + vbYesNo + vbDefaultButton2, "Distribute all
Invoices")
If nRtnValue = vbYes Then
MsgBox "All these Invoices will have Invoice Numbers."
DoCmd.Hourglass True
subSetInvoiceValues
Application.SysCmd acSysCmdSetStatus, "Process is completed."
Application.SysCmd acSysCmdClearStatus
DoCmd.Hourglass False
End If
End Sub

But, I'd be inclined to give that warning on the first MsgBox, and eliminate
the need for the second MsgBox altogether:

Private Sub cmdDistributeAllInvoices_Click()
Dim nRtnValue As Integer

nRtnValue = MsgBox("Are you sure you want to Distribute All Invoices?" &
_
vbCrLf & vbCrLf & "If you choose Yes, all the invoices will
have Invoice Numbers.", _
vbCritical + vbYesNo + vbDefaultButton2, "Distribute all
Invoices")
If nRtnValue = vbYes Then
DoCmd.Hourglass True
subSetInvoiceValues
Application.SysCmd acSysCmdSetStatus, "Process is completed."
Application.SysCmd acSysCmdClearStatus
DoCmd.Hourglass False
End If
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
 
Bob,

Just the one message box??

OK, put a breakpoint on the line with the first message box, then F8 through
the code to work out what it's doing.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
 
This only produced one message box...thanx Bob

Private Sub cmdDistributeAllInvoices_Click()
Dim nRtnValue As Integer

nRtnValue = MsgBox("Are you sure you want to Distribute All Invoices?" &
vbCrLf & vbCrLf & "If you choose Yes, all the Invoices will have Invoice
Numbers.", vbCritical + vbYesNo + vbDefaultButton2, "Distribute all
Invoices")
If nRtnValue = vbYes Then
DoCmd.Hourglass True
subSetInvoiceValues
Application.SysCmd acSysCmdSetStatus, "Process is completed."
Application.SysCmd acSysCmdClearStatus
DoCmd.Hourglass False
End If
End Sub
 
Graham how do you get a 2nd line to appear in a message box without it going
to its widest margin....Thanx Bob
 
By including the following in your message as Graham indicated:

......All Invoices?" & vbCrLf & vbCrLf & "If you choose ......

It is the vbCrLf that causes it to drop down a line. If that doesn't
seem to work you can also use char(13) in place of the vbCrLf.

In the example Graham supplied, it would drop down two lines because
there are 2 line feed characters.

Ron
 
By including the following in your message as Graham indicated:

......All Invoices?" & vbCrLf & vbCrLf & "If you choose ......

It is the vbCrLf that causes it to drop down a line. If that doesn't
seem to work you can also use char(13) in place of the vbCrLf.

In the example Graham supplied, it would drop down two lines because
there are 2 line feed characters.

Ron
 
Bob,

Your code only produced one message box because only one is defined. The
code I gave you produces two.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
 
Back
Top