miguel vasquez
Registered User.
- Local time
- Today, 13:21
- Joined
- Nov 11, 2002
- Messages
- 36
Hi Guys,
I am trying to do this small programming in VBA, but one of the below if statement is not working. The first If statement works, if I remove the second one and viceversa. If me.deptname is working.
If Me.TypeOfReport <> "Both" Then
strRPT = "'" & Me.TypeOfReport & "'"
strRPT1 = "'" & Me.TypeOfReport & "'"
ElseIf Me.TypeOfReport = "Both" Then
strRPT = "'Recovery'"
strRPT1 = "'Settlement'"
If Me.DeptName <> "All" Then
strDept = "'" & Me.DeptName & "'"
strSQL = "Select * into ReportTable from MainTable Where (type =" & strRPT & " or type =" & strRPT1 & ") and (DepartmentName =" & strDept & ")"
DoCmd.RunSQL strSQL
DoCmd.OpenTable "ReportTable", acNormal, acEdit
I am trying to do this small programming in VBA, but one of the below if statement is not working. The first If statement works, if I remove the second one and viceversa. If me.deptname is working.
If Me.TypeOfReport <> "Both" Then
strRPT = "'" & Me.TypeOfReport & "'"
strRPT1 = "'" & Me.TypeOfReport & "'"
ElseIf Me.TypeOfReport = "Both" Then
strRPT = "'Recovery'"
strRPT1 = "'Settlement'"
If Me.DeptName <> "All" Then
strDept = "'" & Me.DeptName & "'"
strSQL = "Select * into ReportTable from MainTable Where (type =" & strRPT & " or type =" & strRPT1 & ") and (DepartmentName =" & strDept & ")"
DoCmd.RunSQL strSQL
DoCmd.OpenTable "ReportTable", acNormal, acEdit