Message box to appear twice!

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
 
G

Graham R Seach

Bob,

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

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
B

Bob

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
 
G

Graham R Seach

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
---------------------------
 
G

Graham R Seach

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
---------------------------
 
B

Bob

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
 
B

Bob

Graham how do you get a 2nd line to appear in a message box without it going
to its widest margin....Thanx Bob
 
R

Ron2006

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
 
R

Ron2006

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
 
G

Graham R Seach

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
---------------------------
 

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