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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent Help NEEDED

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Public Function BUILD_QUERY_STRING()
On Error GoTo Err_BUILD_QUERY_STRING



reportSqlString = "SELECT * FROM " & reportQuery & " WHERE location = '" & strLocation & "' AND onLine = True"


If Me.ckFacilityName Then
reportSqlString = reportSqlString & " AND FACILITYNAME = " & """" & FACILITYNAME & """"
End If
If Me.ckZip Then
reportSqlString = reportSqlString & " AND ZIPCODE = '" & ZIPCODE & "'"
End If
If Me.ckFacilityType Then
reportSqlString = reportSqlString & " AND FACILITYTYPEID = " & facilityType
End If
If Me.ckArea Then
reportSqlString = reportSqlString & " AND areaID = " & AREA
End If
If Me.ckPTSystem Then
reportSqlString = reportSqlString & " AND ptSystemID = " & PRETREATMENTSYSTEM
End If
If Me.ckAddress Then
reportSqlString = reportSqlString & " AND ADDRESS = '" & Me.ADDRESS & "'"
End If
If Me.ckStatus Then
reportSqlString = reportSqlString & " AND statusID = " & STATUS
End If
If Me.ckStatus2 Then
reportSqlString = reportSqlString & " OR statusID = " & STATUS2
End If
If Me.ckTypeOfSystem Then
reportSqlString = reportSqlString & " AND systemID = " & TYPEOFSYSTEM
End If
If Me.ckDates Then
strDateStart = Me.startDate
strDateEnd = Me.endDate
reportSqlString = reportSqlString & " AND INSPDATE >= #" _
& startDate & &quot;# AND INSPDATE <= #&quot; & endDate & &quot;#&quot;
End If
If Me.ckREINSP Then
dateReinspect = reinspectionDate
dateReinspectEnd = reinspectionDateEnd
reportSqlString = reportSqlString & &quot; AND REINSPDATE >= #&quot; & Me.reinspectionDate & &quot;#&quot; _
& &quot; AND REINSPDATE <= #&quot; & Me.reinspectionDateEnd & &quot;#&quot;
End If

If Me.ckDates Then
reportSqlString = reportSqlString & &quot; ORDER BY INSPDATE&quot;
End If

Exit_BUILD_QUERY_STRING:
Exit Function

Err_BUILD_QUERY_STRING:
MsgBox Err.Description
Resume Exit_BUILD_QUERY_STRING

End Function


Everything works fine except this block of if statements:
If Me.ckPTSystem Then
reportSqlString = reportSqlString & &quot; AND ptSystemID = &quot; & PRETREATMENTSYSTEM
End If
It keeps prompting me to enter parameter.
Please help!!!
 
Little long ot read... but, is the ptSystemID a numeric value? If not, try ...ptSystemID = '&quot; & PRETREATMENTSYSTEM & &quot;'&quot;

Put a msgbox(reportSqlString) to see what the value is or use debug.print...

htwh Steve Medvid
&quot;IT Consultant & Web Master&quot;
e-Mail: Stephen_Medvid@GMACM.com

Chester County, PA Residents
Please Show Your Support...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top