I modified a module, which was initally working fine when we tested it, but now I'm getting a syntax error in INSERT INTO statement (3134) DAO.Database. I have looked over the table and stored procedure, which all look fine. The syntax error must be in the code, but I'm not seeing it. Can someone take a look at this code and tell me what's causing this error? Thanks in advance, here is the code:
'
' Retrieve Group Number Updates
'
With rstGroupRecs
.CursorLocation = adUseClient
.CursorType = adOpenForwardOnly
.LockType = adLockReadOnly
.ActiveConnection = g_conOLEDB
.Open "Exec spSelectGroupNumberUpdates"
If (Not (rstGroupRecs.EOF)) Then
dbsBillSysDB.Execute "DELETE * FROM [GROUP NUMBER UPDATE TABLE];", dbSeeChanges
Do While (Not (rstGroupRecs.EOF))
strSQL = "INSERT INTO [GROUP NUMBER UPDATE TABLE] ( [DEDUCTION GROUP NUMBER], [EMPLOYEE GROUP NUMBER], " & _
"[EMPLOYEE SSN], [SERVICE CODE], [EMPLOYER NUMBER], " & _
"[OLD EMPLOYER NUMBER])" 'added by DEK 6/15/07
strSQL = strSQL & " SELECT '" & rstGroupRecs.Fields("DEDUCTION GROUP NUMBER").Value & "', "
strSQL = strSQL & "'" & rstGroupRecs.Fields("EMPLOYEE GROUP NUMBER").Value & "' , "
strSQL = strSQL & "'" & rstGroupRecs.Fields("EMPLOYEE SSN").Value & "' , "
strSQL = strSQL & "'" & rstGroupRecs.Fields("SERVICE CODE").Value & "', "
strSQL = strSQL & " " & rstGroupRecs.Fields("NEWCLIENTNO").Value & " , " 'added by DEK 6/15/07
strSQL = strSQL & " " & rstGroupRecs.Fields("OLDCLIENTNO").Value & " " 'added by DEK 6/15/07
dbsBillSysDB.Execute strSQL, dbSeeChanges
rstGroupRecs.MoveNext
Loop
If (Are_There_Records("GROUP NUMBER UPDATE TABLE")) Then
DoCmd.OpenReport "GROUP NUMBER FILE LOAD UPDATES REPORT", acViewNormal
End If
End If
.Close
End With
'
' Retrieve Group Number Updates
'
With rstGroupRecs
.CursorLocation = adUseClient
.CursorType = adOpenForwardOnly
.LockType = adLockReadOnly
.ActiveConnection = g_conOLEDB
.Open "Exec spSelectGroupNumberUpdates"
If (Not (rstGroupRecs.EOF)) Then
dbsBillSysDB.Execute "DELETE * FROM [GROUP NUMBER UPDATE TABLE];", dbSeeChanges
Do While (Not (rstGroupRecs.EOF))
strSQL = "INSERT INTO [GROUP NUMBER UPDATE TABLE] ( [DEDUCTION GROUP NUMBER], [EMPLOYEE GROUP NUMBER], " & _
"[EMPLOYEE SSN], [SERVICE CODE], [EMPLOYER NUMBER], " & _
"[OLD EMPLOYER NUMBER])" 'added by DEK 6/15/07
strSQL = strSQL & " SELECT '" & rstGroupRecs.Fields("DEDUCTION GROUP NUMBER").Value & "', "
strSQL = strSQL & "'" & rstGroupRecs.Fields("EMPLOYEE GROUP NUMBER").Value & "' , "
strSQL = strSQL & "'" & rstGroupRecs.Fields("EMPLOYEE SSN").Value & "' , "
strSQL = strSQL & "'" & rstGroupRecs.Fields("SERVICE CODE").Value & "', "
strSQL = strSQL & " " & rstGroupRecs.Fields("NEWCLIENTNO").Value & " , " 'added by DEK 6/15/07
strSQL = strSQL & " " & rstGroupRecs.Fields("OLDCLIENTNO").Value & " " 'added by DEK 6/15/07
dbsBillSysDB.Execute strSQL, dbSeeChanges
rstGroupRecs.MoveNext
Loop
If (Are_There_Records("GROUP NUMBER UPDATE TABLE")) Then
DoCmd.OpenReport "GROUP NUMBER FILE LOAD UPDATES REPORT", acViewNormal
End If
End If
.Close
End With