Upload Excel to Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello.
I have an xls file that i want to append to an Access table that has an
autonumber field.
How can i upload this information from Excel to Access?
 
Presuming that your Excel table is the same structure as your Access table,
you should be able to append the Excel data to your Access table like so:

1) Open both your Excel worksheet and your Access database & table you wish
to append
2) Select and copy the Excel data (no headers).
3) Switch to Access, and while viewing the table you wish to update, select
"Edit, Paste Append" from the menu.

The copied rows/records will be appended and the autonumbered field will be
updated appropriately (overwriting any values that might have been in the
related Excel data).

-Glenn Ray
MOS Master
 
Ok, but i'd like to do it programatically.

Glenn Ray said:
Presuming that your Excel table is the same structure as your Access table,
you should be able to append the Excel data to your Access table like so:

1) Open both your Excel worksheet and your Access database & table you wish
to append
2) Select and copy the Excel data (no headers).
3) Switch to Access, and while viewing the table you wish to update, select
"Edit, Paste Append" from the menu.

The copied rows/records will be appended and the autonumbered field will be
updated appropriately (overwriting any values that might have been in the
related Excel data).

-Glenn Ray
MOS Master
 
Programmatically is tricky. Unless you are familliar with ADODB and
recordsets then you will be in way over your head. This is not a project for
the Newbie. That having been said if you are ok with ADO then with a little
searching on the web you should be able to get yourself started. After that
we would be more than happy to help you with any specific problems you might
have...

HTH
 
Jim said:
Programmatically is tricky. Unless you are familliar with ADODB and
recordsets

'Recordsets' may be a red herring here e.g.

Sub no_recordset_needed()
Dim con As Object
Set con = CreateObject("ADODB.Connection")
con.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Tempo\New_Jet_DB.mdb"
con.Execute _
"INSERT INTO MyTable (data_col)" & _
" SELECT F1 AS data_col FROM" & _
" [Excel 8.0;HDR=NO;Database=C:\Tempo\db.xls;]" & _
".[Sheet1$B2:E65535];"
End Sub

Jamie.

--
 
Hi!

There is simpler way to do this. You can make a link from Access/tables view
to the Excel file. Then you can work with that linked file as with any other
table that you have in Access.

Make a right click on the blank space while you are in the Tables view in
Access and choose Link tables.

Then in the field files of type choose xls type of file and select your file
on the disk.

I hope that you will manage to go further alone. If not just ask.

Regards,
Markonni


Jamie Collins said:
Jim said:
Programmatically is tricky. Unless you are familliar with ADODB and
recordsets

'Recordsets' may be a red herring here e.g.

Sub no_recordset_needed()
Dim con As Object
Set con = CreateObject("ADODB.Connection")
con.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Tempo\New_Jet_DB.mdb"
con.Execute _
"INSERT INTO MyTable (data_col)" & _
" SELECT F1 AS data_col FROM" & _
" [Excel 8.0;HDR=NO;Database=C:\Tempo\db.xls;]" & _
".[Sheet1$B2:E65535];"
End Sub

Jamie.
 
Markonni said:
There is simpler way to do this. You can make a link from Access/tables view
to the Excel file.

The OP posted in .excel.programming then said, "i'd like to do it
programatically", so how about posting some *Excel code* to create the
linked table. Your approach is only simpler if operating on the same
Excel file each time.

Jamie.

--
 

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

Back
Top