Importing fields from Word or Excel to one record

  • Thread starter Thread starter Rickard Sweden
  • Start date Start date
R

Rickard Sweden

I know how to import a simple file to a table in access.
But if I want to make a form in word or excel where I
place every new field in a row instead of columns. For
example, if I use Excel, I will place the headings in the
first column and the data in the second column.
Company Microsoft
Contact Paul Simon
Address Unbelivableroad 13
zip 664 84
State USA

Then I want to import all data(fields) to one record in a
table in access. Can it be done? Please help! I would
appreciate any help.
 
As replied to your earlier post, yes, it can
be done (using vba).

In outline, you'd do this - if using Excel
with Access:

In the Access vba editor, open the Tools
menu and select References, Set a
reference to the Excel and DAO object
libraries.

In the editor, write vba code to use the
CreateObject/GetObject built-in functions
to open the Excel file.

Set object variables to point to the Excel
cells containing the data.

Open a DAO recordset on the table into
which you wish to insert the new record and
add a new record using the data captured
from Excel.

This is straightforward when you're familiar with
vba programming, Automation and DAO. But if
you're not familiar, you may feel like you're
climbing mountain - because you've got to get to
grips with three major topics.

You may find it helpful to read up about
"Automation" (specifically GetObject/
CreateObject), "DAO" and setting and
destroying object variables.

Geoff

PS You could use ADO instead of DAO.
ADO is Microsoft's preferred replacement
to DAO. However, a lot of people are familiar
with DAO (Data Access Objects), which is
slightly quicker.
 
Back
Top