insert into syntax error

  • Thread starter Thread starter SuzyQ
  • Start date Start date
S

SuzyQ

I have the following code in my report (on open)

strSQL = "INSERT INTO tblProjectSummary (District, Group, ProjectCode,
FreezeTime, Description, "
strSQL = strSQL & "LaborHours, LaborAmount, EquipmentHours, EquipmentAmount,
MaterialsAmount) "
strSQL = strSQL & "VALUES ('" & strDistrict & "', '" & strGroup & "', '" &
strProject & "', #"
strSQL = strSQL & dteFreezeTime & "#, '" & strDescription & "', " &
dblLaborHours & ", "
strSQL = strSQL & dblLaborTotal & ", " & dblEquipmentHours & ", " &
dblEquipmentTotal & ", "
strSQL = strSQL & dblMaterialsTotal & ")"

DoCmd.RunSQL (strSQL) 'I Get syntax error here

__________________________________________________
after string set up
strsql =

INSERT INTO tblProjectSummary (District, Group, ProjectCode, FreezeTime,
Description, LaborHours, LaborAmount, EquipmentHours, EquipmentAmount,
MaterialsAmount) VALUES (' ', ' ', '0229', #8/26/2009 4:18:47 PM#, ' ', 5,
103.172309281828, 16, 14, 0)

data types are correct
spelling is correct

Can anyone see what my syntax error is, because I can't?
 
DoCmd.RunSQL (strSQL) 'I Get syntax error here

Try DoCmd.RunSQL strSQL

or - better, since it will avoid nag prompts and trap errors -

CurrentDb.Execute strSQL, dbFailOnError
 
Back
Top