Syntax error in INSERT INTO statement

P

pvdalen

I hate to bother anyone with something so relatively minor in scope, but I've
been looking at this statement for hours and just can't seem to find the
syntax error. Pease help!

I apologize for the sloppy look of the cut and paste, but I wanted to
reproduce it as is, with all the spaces and carriage returns represented.

Thanks very much (AGAIN) in advance,
Paul

sSQL2 = ("insert into generator values '" & GenSN.Value & "','" &
GenSpec.Value & "','" & _
GenModel.Value & "','" & EngineSN.Value & "',#" &
Format(StartUp.Value, "mm\/dd\/yyyy") & "#,'" & _
StartUpTech.Value & "'," & GenCost.Value & "," & GenSalePrice.Value
& "," & _
EInstallCost.Value & "," & EInstallPrice.Value & "," &
GasLineCost.Value & "," & _
GasLinePrice.Value & "," & ",#" & Format(InstallStartDate.Value,
"mm\/dd\/yyyy") & "#,#" & _
Format(InstallEndDate.Value, "mm\/dd\/yyyy") & "#,'" &
InstallTech.Value & "',#" & _
Format(WarrentyDate.Value, "mm\/dd\/yyyy") & "#," & cCust & ";")
 
D

Douglas J. Steele

The syntax is

INSERT INTO target [(field1[, field2[, ...]])]
VALUES (value1[, value2[, ...])

In other words, you forgot the ( after the word values, and the ) at the end
(where you have the ; currently). The ; isn't required.
 
D

Duane Hookom

Also, it looks like you have two commas together in this section:
GasLinePrice.Value & "," & ",#" &

--
Duane Hookom
MS Access MVP


Douglas J. Steele said:
The syntax is

INSERT INTO target [(field1[, field2[, ...]])]
VALUES (value1[, value2[, ...])

In other words, you forgot the ( after the word values, and the ) at the
end (where you have the ; currently). The ; isn't required.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



pvdalen said:
I hate to bother anyone with something so relatively minor in scope, but
I've
been looking at this statement for hours and just can't seem to find the
syntax error. Pease help!

I apologize for the sloppy look of the cut and paste, but I wanted to
reproduce it as is, with all the spaces and carriage returns represented.

Thanks very much (AGAIN) in advance,
Paul

sSQL2 = ("insert into generator values '" & GenSN.Value & "','" &
GenSpec.Value & "','" & _
GenModel.Value & "','" & EngineSN.Value & "',#" &
Format(StartUp.Value, "mm\/dd\/yyyy") & "#,'" & _
StartUpTech.Value & "'," & GenCost.Value & "," &
GenSalePrice.Value
& "," & _
EInstallCost.Value & "," & EInstallPrice.Value & "," &
GasLineCost.Value & "," & _
GasLinePrice.Value & "," & ",#" & Format(InstallStartDate.Value,
"mm\/dd\/yyyy") & "#,#" & _
Format(InstallEndDate.Value, "mm\/dd\/yyyy") & "#,'" &
InstallTech.Value & "',#" & _
Format(WarrentyDate.Value, "mm\/dd\/yyyy") & "#," & cCust & ";")
 
P

pvdalen

Thank you both very much. Worked like a charm!


Duane Hookom said:
Also, it looks like you have two commas together in this section:
GasLinePrice.Value & "," & ",#" &

--
Duane Hookom
MS Access MVP


Douglas J. Steele said:
The syntax is

INSERT INTO target [(field1[, field2[, ...]])]
VALUES (value1[, value2[, ...])

In other words, you forgot the ( after the word values, and the ) at the
end (where you have the ; currently). The ; isn't required.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



pvdalen said:
I hate to bother anyone with something so relatively minor in scope, but
I've
been looking at this statement for hours and just can't seem to find the
syntax error. Pease help!

I apologize for the sloppy look of the cut and paste, but I wanted to
reproduce it as is, with all the spaces and carriage returns represented.

Thanks very much (AGAIN) in advance,
Paul

sSQL2 = ("insert into generator values '" & GenSN.Value & "','" &
GenSpec.Value & "','" & _
GenModel.Value & "','" & EngineSN.Value & "',#" &
Format(StartUp.Value, "mm\/dd\/yyyy") & "#,'" & _
StartUpTech.Value & "'," & GenCost.Value & "," &
GenSalePrice.Value
& "," & _
EInstallCost.Value & "," & EInstallPrice.Value & "," &
GasLineCost.Value & "," & _
GasLinePrice.Value & "," & ",#" & Format(InstallStartDate.Value,
"mm\/dd\/yyyy") & "#,#" & _
Format(InstallEndDate.Value, "mm\/dd\/yyyy") & "#,'" &
InstallTech.Value & "',#" & _
Format(WarrentyDate.Value, "mm\/dd\/yyyy") & "#," & cCust & ";")
 

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