INSERT INTO syntax

O

owilson

Hi,

I have the following insert statement:

strSQL = "INSERT INTO BillingTable (DivNo, ItemDesc,
Billing Amount, JobNum, YearMonth)" _
& "VALUES (DivNo, ItemDesc, Billing Amount,
JobNum, YearMonth)"

DoCmd.RunSQL strSQL

It works if I take out Billing Amount, but generates
a "Syntax Error" if I include Billing Amount.

Billing Amount is a number, the only one in the statement.

What am I doing wrong?

TIA

Owen
 
G

Guest

hi,
get rid of the space in billing amount. make it
BillingAmount
There are a number of characters you should avoid in
nameing convictions. the space cahracter is one of them.
 
O

owilson

Thanks, but that didn't help. When I print strSQL in the
immediate window, all the values are correct and
BillingAmount doesn't even register...No Null, No "", no
nothin'

Is there something unique about a number field?
 
A

Andi Mayer

Hi,

I have the following insert statement:

strSQL = "INSERT INTO BillingTable (DivNo, ItemDesc,
Billing Amount, JobNum, YearMonth)" _
& "VALUES (DivNo, ItemDesc, Billing Amount,
JobNum, YearMonth)"

DoCmd.RunSQL strSQL

It works if I take out Billing Amount, but generates
a "Syntax Error" if I include Billing Amount.

Billing Amount is a number, the only one in the statement.

What am I doing wrong?
what <[email protected]> says is right, but if you
can't avoid the blanks then insert the field into "["
like [Billing Amount]
 

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