Can anyone spot what went wrong.
Im trying to update a couple of fields in the main table of a DB. But when i try to run this query i get an error
"Runtime Error 3075"
"syntax error (missing operator) in query expresion"
Function WorkFM()
Dim ThisDB As DAO.Database
Dim WMFRecSet As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT [STATUS], [CompDate], [FBR] " & _
"FROM tblMain LEFT JOIN [qryAccGroup] " & _
"ON tblMain.[FBR] = qryAccGroup.[FullReference] " & _
"WHERE (tblMain.[STATUS] Like 'pen*') AND (qryAccGroup.[FullReference] Is Null);"
Set ThisDB = CurrentDb()
Set WMFRecSet = ThisDB.OpenRecordset(strSQL, dbOpenDynaset)
Do Until WMFRecSet.EOF
WMFRecSet.MoveNext
DoCmd.RunSQL "UPDATE tblMain SET tblMain.[STATUS] = 'COMPLETED', tblMain.[CompDate] = Now() " & _
"WHERE tblMain.[FBR] = strSQL.[FBR];"
Loop
WMFRecSet.Close
End Function
any help is much appreciated
------------------------------------------------------------------------------
Ambition..........If you dont use it, you wont lose it
Im trying to update a couple of fields in the main table of a DB. But when i try to run this query i get an error
"Runtime Error 3075"
"syntax error (missing operator) in query expresion"
Function WorkFM()
Dim ThisDB As DAO.Database
Dim WMFRecSet As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT [STATUS], [CompDate], [FBR] " & _
"FROM tblMain LEFT JOIN [qryAccGroup] " & _
"ON tblMain.[FBR] = qryAccGroup.[FullReference] " & _
"WHERE (tblMain.[STATUS] Like 'pen*') AND (qryAccGroup.[FullReference] Is Null);"
Set ThisDB = CurrentDb()
Set WMFRecSet = ThisDB.OpenRecordset(strSQL, dbOpenDynaset)
Do Until WMFRecSet.EOF
WMFRecSet.MoveNext
DoCmd.RunSQL "UPDATE tblMain SET tblMain.[STATUS] = 'COMPLETED', tblMain.[CompDate] = Now() " & _
"WHERE tblMain.[FBR] = strSQL.[FBR];"
Loop
WMFRecSet.Close
End Function
any help is much appreciated
------------------------------------------------------------------------------
Ambition..........If you dont use it, you wont lose it