View Full Version : Help w/ And Or statement


vincentd
11-11-2007, 04:53 PM
I would like the following code to display the specifed report if either a "0A" (zero A) or "0B" is present. These are prefixes to an eight digit retirement code that is displayed on a report and on an ASCII file.

The code line with the "0A" is in bold.

If bRetirementNo0 = False And sRetirementNo < "50000000" Then
If lReportcode = "010" Then
StrASCIIText = StrASCIIText & String(8 - Len(sRetirementNo), "0") & Trim(sRetirementNo)
ElseIf lReportcode = "020" Then
 sRetirementNo = "0A" & Mid(sRetirementNo, 2) StrASCIIText = StrASCIIText & String(8 - Len(sRetirementNo), "0") & Trim(sRetirementNo)
End If

sSql = "INSERT INTO tl_PR_NYSRetirementReport "
sSql = sSql & "(fknCompany, fknEmployee, sName, sRetirementNumber, sSocialSecurityNumber, nTier, cGrossSalary )"
sSql = sSql & "SELECT DISTINCTROW "
sSql = sSql & "td_PREmployees.fknCompany, "
sSql = sSql & "AND ((td_PRCalculatedHistory.ynVoided)=False) "
sSql = sSql & "AND ((IIf(Not IsNull([sRetirementAccountNumber]) "
 sSql = sSql & "And Left$([sRetirementAccountNumber],2)='0A',True,False))"
If Me!opgReportType = 1 Then
sSql = sSql & "=False)) "
Else
sSql = sSql & "=True)) "
End If

vincentd
11-11-2007, 05:14 PM
Additional Info.

The code is suppose to determine if an employee's retirement number begins with an "0A" and if it does, it's to be displayes on report code 20. If it doesn't, then it's to be displayed on report 10.
Both reports, by code number are exported to an ASCII file.
I was hoping to add some additional code that would instruct the program to include "0B" as well as "0A" and follow the same conditions described in the code.