|
楼主 |
发表于 2015-3-18 09:32
|
显示全部楼层
zhaogang1960 发表于 2015-3-17 17:34
数据表与工作表的字段应该一一对应,如果不一致,则需要使用别名实现
另外,如果不经过将excel数据存入access,直接调用行么.- Sub t1()
- Dim str, sql As String
- Dim rs As New ADODB.Recordset
- str = ThisWorkbook.Path '路径
- sql = "Select b.分类,a.客户,a.期初,a.发货,a.收款,a.折扣/运费,a.余额 " _
- & "from [Excel 8.0;hdr=no;Database=" & ThisWorkbook.FullName & ";].[账龄主界面$a4:f" & Sheet1.[a65536].End(xlUp).Row & "] a " _
- & "left join class b on a.客户 = b.客户"
- Debug.Print sql
- Set rs = funRst(sql, str & "\cdsales.mdb")
- With Sheet2
- .Activate
- .Cells.Clear
- .[a4].CopyFromRecordset rs
- End With
- End Sub
复制代码 此代码提示参数没有指定.
分步我已经实现了处理. |
|