|
各位好,我对这些语句一点都不通
下面的语句也在论坛上找到的很好用
我利用下面的语句,将access的每条记录导出为一个txt文件,txt文件名称为“标题”字段
我的access的表头有 ID,标题,内容,其他,网址
目前导出来的txt文件内容是整行数据,我只要txt文档内容为“标题,内容”
请问需要如何修改,谢谢
Private Sub Command0_Click()
Dim rs As Object
Dim rst As Object
Dim strT As String
Dim strFileName As String
Dim lngHandle As Long
Set rs = CreateObject("adodb.recordset")
rs.ActiveConnection = CurrentProject.Connection
rs.Open ("select distinct 标题 from content")
Set rst = CreateObject("adodb.recordset")
rst.ActiveConnection = CurrentProject.Connection
Do Until rs.EOF
rst.Open ("select * from content where 标题='" & rs(0) & "'")
strT = rst.GetString(, , " ", Chr(13) & Chr(10))
rst.Close
strFileName = CurrentProject.Path & "\" & rs(0) & ".txt"
lngHandle = FreeFile()
Open strFileName For Output As lngHandle
Print #lngHandle, strT
Close lngHandle
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
Set rst = Nothing
End Sub
Private Sub Form_Close()
DoCmd.Quit
End Sub
|
|