Hi, I've build this query in VBA so it was easy to use lots af variables. But for some reason I can't get it to work properly. I'm searching on this for the last 2 hours and i'm getting desperate. - db.Execute ("INSERT INTO tmpOverzicht(eadnr, naam, voornaam, geslacht, leeftijd, gewicht, lengte, BMI, fvc, fev) VALUES (" & rst.Fields(0).Value & "," & cstr(rst.Fields(1).Value) & "," & cstr(rst.Fields(2).Value) & "," & cstr(rst.Fields(4).Value) & "," & cstr(DateDiff("yyyy", rst.Fields(3).Value, now())) & "," & cstr(rst2.Fields(1).Value) & "," & cstr(rst3.Fields(1).Value) & "," & cstr((rst2.Fields(1).Value / (rst3.Fields(1).Value * rst3.Fields(1).Value))) & "," & cstr(rst4.Fields(0).Value) & "," & cstr(rst4.Fields(1).Value)) & ";")
Greetz
Twanne
1 1086
When passing strings you will need to surround them with single quotes. You will also have to leave spaces after the commas and after the tablename and before the bracket. You also have to enclose the closing brackets on the VALUES in quotes. Try this out... -
-
db.Execute ("INSERT INTO tmpOverzicht (eadnr, naam, voornaam, geslacht, leeftijd, gewicht, lengte, BMI, fvc, fev) VALUES (" & _
-
rst.Fields(0).Value & ", '" & CStr(rst.Fields(1).Value) & "', '" & CStr(rst.Fields(2).Value) & "', '" & CStr(rst.Fields(4).Value) & _
-
"', " & CStr(DateDiff("yyyy", rst.Fields(3).Value, now())) & "', '" & CStr(rst2.Fields(1).Value) & "', '" & CStr(rst3.Fields(1).Value) & "', '" & _
-
CStr((rst2.Fields(1).Value / (rst3.Fields(1).Value * rst3.Fields(1).Value))) & "', '" & CStr(rst4.Fields(0).Value) & "', '" & CStr(rst4.Fields(1).Value) & "');")
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: netpurpose |
last post by:
I need to extract data from this table to find the lowest prices of
each product as of today. The product will be listed/grouped by the
name only, discarding the product code - I use...
|
by: sah |
last post by:
I need some help with the following query:
DECLARE @SRV VARCHAR(20), @date smalldatetime
SET @SRV = (select @@servername)
SET @date = '20040901'
select Srv_Name = @SRV, DB_Name = 'DB_NAME',...
|
by: sk |
last post by:
I have an applicaton in which I collect data for different parameters
for a set of devices. The data are entered into a single table, each
set of name, value pairs time-stamped and associated with...
|
by: Nick |
last post by:
Deear All,
I would be thankful if you could help me with the following query.
I have two tables TableA and TableB
TableA
Name: David
Address: 123 West Side
City: New York
|
by: K. Crothers |
last post by:
I administer a mechanical engineering database. I need to build a
query which uses the results from a subquery as its input or
criterion.
I am attempting to find all of the component parts of...
|
by: ward |
last post by:
Greetings.
Ok, I admit it, I bit off a bit more than I can chew.
I need to complete this "Generate Report" page for my employer and I'm
a little over my head. I could use some additional...
|
by: L. R. Du Broff |
last post by:
I own a small business. Need to track a few hundred pieces of rental
equipment that can be in any of a few dozen locations. I'm an old-time C
language programmer (UNIX environment). If the only...
|
by: pamelafluente |
last post by:
I am beginning aspNet, I know well win apps.
Need a simple and schematic code example to start work.
This is what I need to accomplish:
----------------------
Given button and a TextBox on a...
|
by: write2ashokkumar |
last post by:
hi...
i have the table like this,
Table Name : sample
Total Records : 500000 (Consider like this)
Sample Records:
id ------------ name
|
by: pbd22 |
last post by:
Hi.
I need some help with structuring my query strings.
I have a form with a search bar and some links. Each
link is a search type (such as "community"). The HREF
for the link's anchor looks...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |