|
3#
楼主 |
发表于 2012-7-6 16:32:19
|
只看该作者
Private Sub Command0_Click()
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
Dim FNum As Integer
Dim FName As String
FNum = FreeFile
FName = "c:\MOMT03.csv"
Open FName For Append As FNum ' 如将 Open 取代 Append 则新建立一个文件
stemp = "select * from MO_Header_MOMT03" '打开表"
rst.Open stemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Do Until rst.EOF
Print #FNum, rst!MO; ","; rst!planner; ","; rst!起始工作中心; ","; rst!交货地点; ","; rst!text_no
'If rst!text_no = 0 Then
'Print #FNum, rst!text_no = ""
'End If
rst.MoveNext
Loop
Close #FNum
MsgBox "导出到 c:\MOMT03.csv", vbInformation, "提示"
End Sub
|
|