Skip to main content
added 144 characters in body
Source Link
Tim Williams
  • 169k
  • 8
  • 104
  • 143

Remove the quotes from that second part:

instRptGen_SQL = "SELECT AreaName FROM Area WHERE AreaID =" & _
            Left(rsDB.Fields("ActivityID").Value, 2)

You don't need the terminating ;, and if the fieldAreaID is not numeric you need single quotes around the value.:

instRptGen_SQL = "SELECT AreaName FROM Area WHERE AreaID ='" & _
            Left(rsDB.Fields("ActivityID").Value, 2) & "'"

Remove the quotes from that second part:

instRptGen_SQL = "SELECT AreaName FROM Area WHERE AreaID =" & _
            Left(rsDB.Fields("ActivityID"), 2)

You don't need the terminating ;, and if the field is not numeric you need single quotes around the value.

Remove the quotes from that second part:

instRptGen_SQL = "SELECT AreaName FROM Area WHERE AreaID =" & _
            Left(rsDB.Fields("ActivityID").Value, 2)

You don't need the terminating ;, and if AreaID is not numeric you need single quotes around the value:

instRptGen_SQL = "SELECT AreaName FROM Area WHERE AreaID ='" & _
            Left(rsDB.Fields("ActivityID").Value, 2) & "'"
Source Link
Tim Williams
  • 169k
  • 8
  • 104
  • 143

Remove the quotes from that second part:

instRptGen_SQL = "SELECT AreaName FROM Area WHERE AreaID =" & _
            Left(rsDB.Fields("ActivityID"), 2)

You don't need the terminating ;, and if the field is not numeric you need single quotes around the value.