maverick0728
asked on
Excel VBA transfer recordset to csv file
I have a recordset object that I want to transfer to a .csv file.
Here is the code I have that is returning data to the "result" object. I need to take the "result" object and save it to a UNC path csv file.
Here is the code I have that is returning data to the "result" object. I need to take the "result" object and save it to a UNC path csv file.
Private Sub cmdMoveToERP_Click()
On Error GoTo ErrHandler
If OnNetwork = True Then
Dim data As New clsADOwrapper
Dim strSQL As String
Dim result As Object
strSQL = "SELECT QuoteNum, QuoteLine, AssemblySeq, PartNum, IndentedPartNum, Description, RevisionNum, QtyPer, IUM, Parent, PriorPeer, NextPeer, Child, BomSequence, "
strSQL = strSQL & "BomLevel , RequiredQty FROM dbo.EstAsmTemp "
strSQL = strSQL & "WHERE QuoteNum = '" & Sheets("Initialization").Range("B2").Value & "' "
strSQL = strSQL & "AND QuoteLine = '" & Sheets("Initialization").Range("H2").Value & "' "
Set result = data.cGetRecordset(CONN_STR, strSQL)
'MsgBox (CInt(result.RecordCount))
'HERE NEED TO MOVE result OBJECT TO CSV FILE
Else
MsgBox "Not Connected to Network"
Exit Sub
End If
ErrHandler:
Set data = Nothing
Exit Sub
End Sub
ok, so what object is cGetRecordset returned? is it a ADODB.Recordset object?
ASKER
correct, a ADODB.Recordset object
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
works. thanks.