Importing excel into .adp project

A

Andy G

I have an .ADP with a SQL backend. I made a simple little form that gets
the table name, workbook name, and worksheet name from the user and the
click a button to import a spreadsheet into an existing table. I'm getting
the error, "You tried to assign the Null value to a variable that is not a
Variant data type". The spreadsheet I am trying to import has one column
with values and a header. The table has one column and is defined varchar
100 not null default ' '. Thanks for any help.

Dim table As String
Dim workbook As String
Dim worksheet As String

table = "dbo." & Me![cmbTblName]
workbook = "H:\DS Clients\CFSPH\Data\" & Me![txtWrkbName] & ".xls"
worksheet = Me![txtWrksName]

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, table,
workbook, True, worksheet & "!"


Andy
 

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