insert into syntax error

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?
 
J

John W. Vinson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top