Access Data without Importing or Linking

  • Thread starter Thread starter Guest
  • Start date Start date
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$];
 
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$];
 
Back
Top