upload excel files to access ?

P

pillmill

Hi:

What is a simple VB method
to upload an excel-type datasheet
into an Access database ?

Thanks,
Phil
 
P

pillmill

Thanks Klatuu:

The following is failing with a "type mismatch" error:

Private Sub Form_Load()
DoCmd.TransferSpreadsheet "table3", "C:\test\test.xls", "A1"
End Sub

table3 field1 is type number and,
A1 is the number "1"

Any help would be appreciated.

Regards,
Phil
 
K

Klatuu

DoCmd.TransferSpreadsheet "table3", "C:\test\test.xls", "A1"
The arguments are incorrect. Look up TransferSpreadsheet method in VB Help.
Should be:
DoCmd.TransferSpreadsheet "table3", acImport, ??, "YourTable Name",
"C:\test\test.xls", False, "A1:A1"

Where the ?? is, you need to enter the acSpreadSheetType constant for the
version of Excle you are using. It is an optional arguement, but the default
is acSpreadsheetTypeExcel8. If you choose to use the default, just leave a
space between the commas where it goes so the arguments are in the correct
position
 
Top