本文介绍了访问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.
非常感谢您解决此问题的任何建议。
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
这篇关于访问VBA - 找不到方法或数据成员错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!