易截截图软件、单文件、免安装、纯绿色、仅160KB

Access導出Execl

VB+Access做的系統,
怎樣把數據庫Access內容導出execl?
现在没东西试,从网上找了段代码你看看
VB code:

Private Sub ExportOneTable()

'EXPORTS TABLE IN ACCESS DATABASE TO EXCEL
'REFERENCE TO DAO IS REQUIRED

Dim strExcelFile As String
Dim strWorksheet As String
Dim strDB As String
Dim strTable As String
Dim objDB As Database

'Change Based on your needs, or use
'as parameters to the sub
strExcelFile = "C:\My Documents\MySpreadSheet.xls"
strWorksheet = "WorkSheet1"
strDB = "C:\My Documents\MyDatabase.mdb"
strTable = "MyTable"

Set objDB = OpenDatabase(strDB)

'If excel file already exists, you can delete it here
If Dir(strExcelFile) <> "" Then Kill strExcelFile

objDB.Execute _
"SELECT * INTO [Excel 8.0;DATABASE=" & strExcelFile & _
"].[" & strWorksheet & "] from " & "[" & strTable & "]"
objDB.Close
Set objDB = Nothing

End Sub





http://download.csdn.net/source/1483928

引用
http://download.csdn.net/source/1483928

TKS!


引用
http://download.csdn.net/source/1483928

有問༺


相关问答:

在一张access表中嵌套查询

strSQLCmd.Format(_T("select * from (select * from talk_info where %s ='%s') where %s ='%s'"),
strVar,strValue,strVar2,strValue2);
请问这语句有问题吗
没有问题。
......

access vba 数组长度

access vba 中怎么取得数组长度?
数组行?
UBound(数组名)

ubound()-lbound()

UBound 函数
     

返回一个 Long 型数据,其值为指定的数组维可用的最大下标。

语法 ......

导入excel表格到access后产生的问题?

系统每天产生一个excel文件,格式相同,内容用文件名(用产生的时间命名)区分。我做了一个access数据库,导入excel的数据,我想加一项纪录文件名来区分内容,可是怎么做呢?又或者用什么其他方法可以办到?谢了
你 ......

ACCESS数据库关联查询问题?

初用ACCESS数据库,要实现一个关联查询,sql语句如下:select pid,product_Type.name as tid,name,img_url,context,remark from Product join product_Type on product.type_id = product_Type.type_id order by pid ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号