troubleshooting Question

Coding question

Avatar of urjudo
urjudoFlag for United States of America asked on
Microsoft Access
13 Comments1 Solution309 ViewsLast Modified:
Hi Experts,
I have a coding here, but it seems every time when I do the search, it only gave me the first message "This is A H Case" but it should be "This is a H Case also a LSA." even both the CPHEATER & NCPLSA are true, it only sees the CPHEATER is true and did not see the NCPLSA is true too, can any one see what I did wrong?  I did tried both codings, but the result are the same:
1). If rs!CPHEATER = True And rs!CPDOMVIOL = False And rs!CPMINORMOM = False And rs!NCPLSA = False And stSecurity >= 5 Or rs!CPHEATER = True And rs!CPDOMVIOL = False And rs!CPMINORMOM = False And rs!CPLSA = False And stSecurity >= 5 Then
              MsgBox "This is a H Case.", vbInformation
              stDocName = "frmCP"
              stLinkCriteria = "[CPCASENUM]=" & "'" & Me![FindField] & "'"
              DoCmd.OpenForm stDocName, , , stLinkCriteria
 Else
If (rs!CPHEATER = True And rs!NCPLSA = True And stSecurity >= 5) Or (rs!CPHEATER = True And rs!CPLSA = True And stSecurity >= 5) Then
              MsgBox "Warning, this is a H Case, also a LSA.", vbInformation
              stDocName = "frmCP"
              stLinkCriteria = "[CPCASENUM]=" & "'" & Me![FindField] & "'"
              DoCmd.OpenForm stDocName, , , stLinkCriteria
end if
end if
2). If rs!CPHEATER = True And rs!CPDOMVIOL = False And rs!CPMINORMOM = False And rs!NCPLSA = False And stSecurity >= 5 Or rs!CPHEATER = True And rs!CPDOMVIOL = False And rs!CPMINORMOM = False And rs!CPLSA = False And stSecurity >= 5 Then
              MsgBox "This is a H Case.", vbInformation
              stDocName = "frmCP"
              stLinkCriteria = "[CPCASENUM]=" & "'" & Me![FindField] & "'"
              DoCmd.OpenForm stDocName, , , stLinkCriteria
 Else
If rs!CPHEATER = True And rs!NCPLSA = True And stSecurity >= 5 Or rs!CPHEATER = True And rs!CPLSA = True And stSecurity >= 5 Then
              MsgBox "Warning, this is a H Case, also a LSA.", vbInformation
              stDocName = "frmCP"
              stLinkCriteria = "[CPCASENUM]=" & "'" & Me![FindField] & "'"
              DoCmd.OpenForm stDocName, , , stLinkCriteria
end if
end if
Thanks,
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 13 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros