473,320 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 35804
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: johnnyboy10017 | last post by:
I am having a hell of a time with what I think is a very simple query: It won't actually insert a new record into the specified table, but returns no error, in fact it returns "1" (or true) that...
8
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE,...
2
by: george | last post by:
This is like the bug from hell. It is kind of hard to explain, so please bear with me. Background Info: SQL Server 7.0, on an NT box, Active Server pages with Javascript, using ADO objects. ...
3
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all...
2
by: Geoffrey KRETZ | last post by:
Hello, I'm wondering if the following behaviour is the correct one for PostGreSQL (7.4 on UNIX). I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching the following request :...
7
by: David Bear | last post by:
I have a dictionary that contains a row of data intended for a data base. The dictionary keys are the field names. The values are the values to be inserted. I am looking for a good pythonic...
6
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am...
2
by: cbadchris | last post by:
I am writing an import function with asp, and excel that writes imported excel sheets to to several SQL tables and everything works fine until it reaches the "add data for search" section or query 2....
2
by: lenygold via DBMonster.com | last post by:
Hi Everebody: I have a table: CREATE TABLE CROSS_REFERENCE (ROW# INTEGER NOT NULL ,KEY_WORD CHAR(16) NOT NULL ,QUERY_DESCR VARCHAR(330) NOT NULL ,PRIMARY KEY (ROW#,KEY_WORD)); It is a...
8
by: Betikci Boris | last post by:
Can not insert data into SQLite3 database through browser however i can easily insert data into my db from konsole, in both attmpts i used php 5.2.6 on 2.6.25.* linux kernel i think there is a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.