访问VBA - 找不到方法或数据成员错误
我是Access的新人,并且感谢您先阅读本文。
I'm new to Access and thank you for reading this first.
我在Access中导出一个查询到管道分隔的CSV文件。查询来自从ODBC ODBCed的表。
I'm exporting a query in Access to a pipe delimited CSV file. The query is from a table which is ODBCed from SQL.
我一直在寻找
dbs.Recordset
:方法或数据成员未找到错误。
I've been getting for the line
dbs.Recordset
: Method or data member not found error.
非常感谢您解决此问题的任何建议。
Huge thanks for any suggestion to fix this.
Option Compare Database
Option Explicit
Sub Command12_Click()
Dim dbs As DAO.database
Dim rst As DAO.Recordset
Dim intFile As Integer
Dim strFilePath As String
Dim intCount As Integer
Dim strHold
strFilePath = "C:\temp\TEST.csv"
Set dbs = CurrentDb
Set rst = db.OpenRecordset("T_Export_CSV", dbOpenForwardOnly)
intFile = FreeFile
Open strFilePath For Output As #intFile
Do Until rst.EOF
For intCount = 0 To rst.Fields.Count - 1
strHold = strHold & rst(intCount).Value & "|"
Next
If Right(strHold, 1) = "|" Then
strHold = Left(strHold, Len(strHold) - 1)
End If
Print #intFile, strHold
rst.MoveNext
strHold = vbNullString
Loop
Close intFile
rst.Close
Set rst = Nothing
MsgBox ("Export Completed Successfully")
End Sub
非常感谢您的时间,如果需要,请留下以下任何说明。我会尽我所能来回应!
Thank you so so much for your time and please leave any comment below for any clarification if needed. I will try my best to be responsive!
Office 15.0对象库是您需要包含在O365对象或Office 2013 Access VBA的引用中的对象库
Office 15.0 object library is the one you need to include in the references for O365 objects or Office 2013 Access VBA