Access Data without Importing or Linking

J

John Nurick

You're absolutely right... I feel pretty stupid for missing that.
OK... The process of the import works.. right up until I get the error for
uknown field name: 'F1'.

This is probably happening because the table you are appending to
doesn't have a field 'F1'. The query you have built returns fields named
F1, F2 ...
and if the fields in your table have different names you'll need to
alias them. One or other of these syntaxes should do the job:

INSERT INTO MyTable
(FieldOne, FieldTwo, FieldThree)
SELECT F1, F2, F3
FROM [Excel 8.0;HDR=No;database=C:\Folder\File;].[Sheet1$];

INSERT INTO MyTable
SELECT F1 AS FieldOne, F2 AS FieldTwo, F3 AS FieldThree
FROM [Excel 8.0;HDR=No;database=C:\Folder\File;].[Sheet1$];
 
C

Cydney

Finally!! I tried sample #1 and it worked perfectly.
Thank you!
--
THX cs


John Nurick said:
You're absolutely right... I feel pretty stupid for missing that.
OK... The process of the import works.. right up until I get the error for
uknown field name: 'F1'.

This is probably happening because the table you are appending to
doesn't have a field 'F1'. The query you have built returns fields named
F1, F2 ...
and if the fields in your table have different names you'll need to
alias them. One or other of these syntaxes should do the job:

INSERT INTO MyTable
(FieldOne, FieldTwo, FieldThree)
SELECT F1, F2, F3
FROM [Excel 8.0;HDR=No;database=C:\Folder\File;].[Sheet1$];

INSERT INTO MyTable
SELECT F1 AS FieldOne, F2 AS FieldTwo, F3 AS FieldThree
FROM [Excel 8.0;HDR=No;database=C:\Folder\File;].[Sheet1$];
 

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