Hi,
the TransferSpreadsheet (or similar function) has a parameter specifying whether the input data has a Header Row. This means the firs row to contain the names of the columns, but this is not required.
- if this parameter is True, then the names of the columns the destination table (Jet or Sql-2000) must be the same as the names appearing in the header. I'm finding this rather cumbersome, so I'm not using this option.
- if the parameter is set to False, the the function expects columns named F1, F2, F3, etc in the destination table. This is true for both Jet(MDB) and Sql-2000(ADP) destinations. I'm finding this much more flexible.
rather unusual to have hard-wired names, but it works. So, I have defined a table in Sql-2000 with columns like:
CREATE TABLE t_txn_hist_buff (
auto_key int IDENTITY (1, 1) NOT NULL ,
F1 varchar (250) NULL ,
F2 varchar (250) NULL ,
F3 varchar (250) NULL ,
F4 varchar (250) NULL ,
F5 varchar (250) NULL ,
F6 varchar (250) NULL ,
F7 varchar (250) NULL ,
F8 varchar (250) NULL ,
F9 varchar (250) NULL ,
F10 varchar (250) NULL ,
F11 varchar (250) NULL ,
F12 varchar (250) NULL ,
F13 varchar (250) NULL ,
F14 varchar (250) NULL ,
F15 varchar (250) NULL ,
is_header bit NOT NULL DEFAULT (0),
invalid bit NOT NULL DEFAULT (0),
txn_date datetime NULL ,
CONSTRAINT txn_hist_buff_PK PRIMARY KEY CLUSTERED
(
auto_key
)
)
Then, the VBA code fragment is:
DoCmd.SetWarnings (False)
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
"dbo.t_price_hist_buff", fn, False
Note that I had to use the "dbo" prefix in front of my table name. Apparently, Access Project does not use the standard name resolution of T-Sql. Anyway, it works, and you can see I could add a few work fields after F15.
HTH,
Andrew