Hi all
Got some code running on an alarm DB, things have been filtering through to an area it shouldnt have... to correct this problem the DB designer used AND NOT statements... I have tried to replicate this but failed. Could someone point me in the right direction please.
highlighted my bit in red....
Error message:
Run Time Error: 3142
Characters found after end of SQL statement.
Any help would be much appreciated
THANKS!
Got some code running on an alarm DB, things have been filtering through to an area it shouldnt have... to correct this problem the DB designer used AND NOT statements... I have tried to replicate this but failed. Could someone point me in the right direction please.
highlighted my bit in red....
Code:
Function CAT()
Set db = CurrentDb
strsql = "SELECT [qry_alm].ID_NO, [qry_alm].TIME_STAMP, [qry_alm].SRC_NODE, [qry_alm].POINT_NAME, [qry_alm].ALARM_TYPE, [qry_alm].ALARM_PRIO, [qry_alm].POINT_DSCR, [qry_alm].UNIT_ID " _
& "FROM [qry_alm] " _
& "WHERE " & strDate & " AND " _
& "([qry_alm].UNIT_ID ='FC' Or [qry_alm].UNIT_ID ='FF' Or [qry_alm].UNIT_ID ='FL' Or [qry_alm].UNIT_ID ='M3' " _
& "Or [qry_alm].UNIT_ID ='AS' AND ([qry_alm].ALARM_PRIO Not Like 'LOW*'));" _
[COLOR=red] & "AND NOT ((qry_pPOS_rpt.POINT_NAME) = 'FCU2165' )" _[/COLOR]
'AND [qry_alm].ALARM_PRIO = 'JOURNAL'
If status = "target" Then
CurrentDb.QueryDefs("qry_target").sql = strsql
ElseIf status = "period" Then
CurrentDb.QueryDefs("qry_period").sql = strsql
ElseIf status = "report" Then
CurrentDb.QueryDefs("qry_rpt").sql = strsql
Set rst = db.OpenRecordset(strsql, dbOpenDynaset)
With rst
If rst.RecordCount <= 0 Then
MsgBox ("There have been no alarms in " & combo_val & " for the selected time period.")
DoCmd.Close acForm, "frm_progress"
quit = True
Exit Function
End If
End With
rst.Close
End If
End Function
Error message:
Run Time Error: 3142
Characters found after end of SQL statement.
Any help would be much appreciated
THANKS!