469,931 Members | 1,773 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,931 developers. It's quick & easy.

INSERT INTO Query

I have a SQL statement that is not working.

It reads as follows:

sql = "INSERT INTO tblPaymentInformation ([AuctionDate], [BidderNumber],
[PaymentType], [PaymentNumber], [Amount]) VALUES ('aucdte', 'bidnum',
'paytyp', 'paynum', payamt)"

The variables for the VALUES section are assigned before this sql
statement. The problem occures with the payamt varable. It is a currency
field. When I try to run the SQL statement, it pops an input box asking
payamt.

If I add the ' around the varaable Access gives me a conversion error.
How do I get this to work with a currency varable?

Michael

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
2 35570
Try "...................VALUES ('" & aucdte & "', '" & bidnum & "', '" &
paytyp & "', '" & paynum & "'," & payamt & ")"

Clive

"Nothing" <me@you.com> wrote in message
news:3f*********************@news.frii.net...
I have a SQL statement that is not working.

It reads as follows:

sql = "INSERT INTO tblPaymentInformation ([AuctionDate], [BidderNumber],
[PaymentType], [PaymentNumber], [Amount]) VALUES ('aucdte', 'bidnum',
'paytyp', 'paynum', payamt)"

The variables for the VALUES section are assigned before this sql
statement. The problem occures with the payamt varable. It is a currency
field. When I try to run the SQL statement, it pops an input box asking
payamt.

If I add the ' around the varaable Access gives me a conversion error.
How do I get this to work with a currency varable?

Michael

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #2
If you look at your table, you'll find that you've acutally inserted the
variable names (aucdte, bidnum, etc) in your table ... instead of the VALUES
of the variables. To do that, you need to do this:

sql = "INSERT INTO tblPaymentInformation ([AuctionDate], [BidderNumber],
[PaymentType], [PaymentNumber], [Amount]) VALUES (' " & aucdte & ' ",' " &
bidnum & " ',' " & paytyp & " ',' " & paynum & " '," & payamt & ")"

Note that I have included spaces between the single quotes ( ' ) and the
double quotes ( " ) for readability. In general you do NOT need these spaces
would be advised to remove them before running your insert statement. Note
also that this is "air code" and as such may have some typos ... in general,
you get the idea though.

"Nothing" <me@you.com> wrote in message
news:3f*********************@news.frii.net...
I have a SQL statement that is not working.

It reads as follows:

sql = "INSERT INTO tblPaymentInformation ([AuctionDate], [BidderNumber],
[PaymentType], [PaymentNumber], [Amount]) VALUES ('aucdte', 'bidnum',
'paytyp', 'paynum', payamt)"

The variables for the VALUES section are assigned before this sql
statement. The problem occures with the payamt varable. It is a currency
field. When I try to run the SQL statement, it pops an input box asking
payamt.

If I add the ' around the varaable Access gives me a conversion error.
How do I get this to work with a currency varable?

Michael

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by johnnyboy10017 | last post: by
2 posts views Thread by Geoffrey KRETZ | last post: by
7 posts views Thread by David Bear | last post: by
6 posts views Thread by rn5a | last post: by
2 posts views Thread by lenygold via DBMonster.com | last post: by
8 posts views Thread by Betikci Boris | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.