Append sql statment

F

Frank

I have created a sql append statment to gather info from excel spreadsheet.
The problem i seem to be having is adding more then one "FROM" Statment. the
code looks like this:

INSERT INTO PP1SUB ( F1] )
SELECT [Second by second$BW2:BW1881].F1.
FROM [Excel 8.0;HDR=No;database=G:\R&D\Vehicle testing
Data\summary.xls].[Second by second$BW2:BW1881];

What i would like to do is add another feild from the same workbook. What i
have tried is this:
INSERT INTO PP1SUB ( [F1],[F2] )
SELECT [Second by second$BW2:BW1881].F1,[Second by second$B2:B1881].F2
FROM [Excel 8.0;HDR=No;database=G:\R&D\Vehicle testing
Data\summary.xls].[Second by second$BW2:BW1881].[Second by second$BW2:BW1881];

When i run this. Access says it is unable to find the second field.
 
G

Gary Walter

Frank said:
I have created a sql append statment to gather info from excel spreadsheet.
The problem i seem to be having is adding more then one "FROM" Statment. the
code looks like this:

INSERT INTO PP1SUB ( F1] )
SELECT [Second by second$BW2:BW1881].F1.
FROM [Excel 8.0;HDR=No;database=G:\R&D\Vehicle testing
Data\summary.xls].[Second by second$BW2:BW1881];

What i would like to do is add another feild from the same workbook. What i
have tried is this:
INSERT INTO PP1SUB ( [F1],[F2] )
SELECT [Second by second$BW2:BW1881].F1,[Second by second$B2:B1881].F2
FROM [Excel 8.0;HDR=No;database=G:\R&D\Vehicle testing
Data\summary.xls].[Second by second$BW2:BW1881].[Second by second$BW2:BW1881];

When i run this. Access says it is unable to find the second field.
Hi Frank,

I am not an Excel expert, but....
I believe you just need to define one all-encompassing range,
then pull F1 and (probably) F49.

You can determine "F49" (or which Fxx it will be) by first starting
with general SELECT SQL in SQL VIEW of QBE
*over complete range*.

SELECT ].[Second by second$B2:BW1881].*
FROM [Excel 8.0;HDR=No;database=G:\R&D\Vehicle testing
Data\summary.xls].[Second by second$B2:BW1881];

Then look at result and find exact Fx's you want.....

From your original query, it looks like you want
to put
BWx into PP1SUB.F1
and
Bx into PP1SUB.F2

if so, I "believe" you will want something like:

INSERT INTO PP1SUB ( [F1],[F2] )
SELECT
[Second by second$B2:BW1881].F49,
[Second by second$B2:BW1881].F1
FROM [Excel 8.0;HDR=No;database=G:\R&D\Vehicle testing
Data\summary.xls].[Second by second$B2:BW1881];

Again, "F49" might not be correct, but you should
be able to determine which F from your original SQL.

Good luck,

Gary Walter
 
G

Gary Walter

that first select should have been:

SELECT [Second by second$B2:BW1881].*
FROM [Excel 8.0;HDR=No;database=G:\R&D\Vehicle testing
Data\summary.xls].[Second by second$B2:BW1881];
 

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