Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If statement with multiple Textboxes 2

Status
Not open for further replies.

ptrifile

Technical User
Aug 10, 2004
457
0
0
US
I have a simple problem that i cannot figure out. At the very basic level i simply want to show a message box when two checkboxes are checked how would i go about that? I have tried the following without any luck.

Code:
if checkbox1 = true & checkbox2 = true then
msgbox "yay"
end if

This is not working, can someone assist?

Thanks in advance.

Paul
 
How about:

Code:
If CheckBox1.Value [blue]And[/blue] CheckBox2.Value Then
    MsgBox "Both chacked"
End If

Have fun.

---- Andy
 
Wow. Really? Thanks Andy, I feel like an idiot now. :)

I appreciate the help!

 
So this question is the same as the first but more of what i am doing with the code. Can anyone see any issues here on why i would not be getting the desired results? It does not seem to be following my logic as the proper "Subject" line is not corresponding with my checkbox selections.

Code:
If Me.FraudRisk.Value = True And Me.Update.Value = False Then


ElseIf Me.PotentialLoss.Value < 1000.01 Then

   cc1 = 
   bcc1 = 
   DoCmd.SendObject acReport, "procedure exception report", "pdf", "", cc1, bcc1, "Fraud Risk - Procedure Exception Notification", "", True, """"



ElseIf Me.PotentialLoss.Value <= 10000 Then

   cc1 = 
   bcc1 = 
   DoCmd.SendObject acReport, "procedure exception report", "pdf", "", cc1, bcc1, "Fraud Risk - Procedure Exception Notification", "", True, """"



ElseIf Me.PotentialLoss.Value > 10000 Then

    to1 = 
    cc1 = 
    bcc1 = 
    DoCmd.SendObject acReport, "procedure exception report", "pdf", to1, cc1, bcc1, "Fraud Risk - Procedure Exception Notification", "", True, """"



End If


'-------------------------------------------------------------

'--------------------------------------------------------------
'add UPDATE to subject field
If Me.Update.Value = True And Me.FraudRisk.Value = False Then


ElseIf Me.PotentialLoss.Value < 1000.01 Then

    cc1 = 
    bcc1 = 
    DoCmd.SendObject acReport, "procedure exception report", "pdf", "", cc1, bcc1, "UPDATE - Procedure Exception Notification - Issue", "", True, """"



ElseIf Me.PotentialLoss.Value <= 10000 Then

    cc1 = 
    bcc1 = 
    DoCmd.SendObject acReport, "procedure exception report", "pdf", "", cc1, bcc1, "UPDATE - Procedure Exception Notification - Issue", "", True, """"



ElseIf Me.PotentialLoss.Value > 10000 Then

    to1 = 
    cc1 = 
    bcc1 = 
    DoCmd.SendObject acReport, "procedure exception report", "pdf", to1, cc1, bcc1, "UPDATE - Procedure Exception Notification", "", True, """"



End If


'-------------------------------------------------------------
If Me.Update.Value = False And Me.FraudRisk.Value = False Then


ElseIf Me.PotentialLoss.Value < 1000.01 Then

    cc1 = 
    bcc1 = 
    DoCmd.SendObject acReport, "procedure exception report", "pdf", "", cc1, bcc1, "Procedure Exception Notification", "", True, """"



ElseIf Me.PotentialLoss.Value <= 10000 Then

    cc1 = 
    bcc1 = 
    DoCmd.SendObject acReport, "procedure exception report", "pdf", "", cc1, bcc1, "Procedure Exception Notification", "", True, """"



ElseIf Me.PotentialLoss.Value > 10000 Then

    to1 = 
    cc1 = 
    bcc1 = 
    DoCmd.SendObject acReport, "procedure exception report", "pdf", to1, cc1, bcc1, "Procedure Exception Notification", "", True, """"

End If

'------------------------------------------------------------
'update if fraud risk





If Me.FraudRisk.Value = True And Me.Update.Value = True Then


ElseIf Me.PotentialLoss.Value < 1000.01 Then

    cc1 = 
    bcc1 = 
    DoCmd.SendObject acReport, "procedure exception report", "pdf", "", cc1, bcc1, "UPDATE Fraud Risk - Procedure Exception Notification", "", True, """"



ElseIf Me.PotentialLoss.Value <= 10000 Then

    cc1 = 
    bcc1 = 
    DoCmd.SendObject acReport, "procedure exception report", "pdf", "", cc1, bcc1, "UPDATE Fraud Risk - Procedure Exception Notification", "", True, """"



ElseIf Me.PotentialLoss.Value > 10000 Then

    to1 = 
    cc1 = 
    bcc1 = 
    DoCmd.SendObject acReport, "procedure exception report", "pdf", to1, cc1, bcc1, "UPDATE Fraud Risk - Procedure Exception Notification", "", True, """"



End If

Thanks again for any help or suggestions.

Paul
 
This might do what you need, however the UNASSIGNED strings are to be assigned on the assumption that the inverse of

A and B

is

not A or not B

Code:
Sub test()
    to1 = ""

    If Not Me.FraudRisk.Value Or Not Me.Update.Value Then
    
            Select Case Me.PotentialLoss.Value
            
                Case Is < 1000.01
            
                   cc1 = ""
                   bcc1 = ""
            
                Case Is <= 10000
                
                   cc1 = ""
                   bcc1 = ""
            
                Case Else
            
                    to1 = ""
                    cc1 = ""
                    bcc1 = ""
            
            End Select
        
            DoCmd.SendObject acReport, "procedure exception report", "pdf", to1, cc1, bcc1, "Fraud Risk - Procedure Exception Notification", "", True, """"
    End If

End Sub

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks PHV, I substituted the "Or" in your example to "and" and it is work beautifully! Thank you so much!

In an interest to learn, i understand that you cut down ALOT of code from what I have but to me it looks like it should have done what i needed. Was it using the "NOT" instead of the value of the checkbox itself?

Thanks again!

Paul
 
PHV ?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
WOW. Thanks Skip! I'm apparently having a rough day!!!!!!! Sorry about that!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top