'步骤4:将记录集rs中的字段名称和字段内容输出到Word,各字段之间用制表符分隔
'输出字段名称
For I = 0 To total_fields - 2
mywdapp.Selection.TypeText Text:=rs.Fields(I).Name & vbTab
Next I
'最后一个字段名称后加回车符
mywdapp.Selection.TypeText Text:=rs.Fields(total_fields - 1).Name & vbCrLf
'逐条输出字段内容
Do While Not rs.EOF
For I = 0 To total_fields - 2
tmpstr = rs.Fields(I).Value
If rs.Fields(I).Name = "单价" Then
tmpstr = Format(tmpstr, "####.00")
End If
mywdapp.Selection.TypeText Text:=tmpstr & vbTab
Next I
'一条记录的最后一个字段后加回车符
mywdapp.Selection.TypeText Text:=rs.Fields(total_fields - 1).Value & vbCrLf
rs.MoveNext
Loop