kjoter
October 19th, 2001, 04:09 AM
Good Morning!
Do somebody know how to get data out of a recordset and into variables? As you can see in the code below, I do a loop on the recordset, and make a print. My problem is that I want to get the each value/field in the recordset into variables first, so I can print it in the order i want afterwords. Now do i get everything into sData variable, and then i am not able to change the order of fields when i do a print...
Do you have a suggestion? Thankful for all answers!
Dim rsAddresses As ADODB.Recordset
Dim rsNames As ADODB.Recordset
Dim paf As PafSearchR
Dim fld As ADODB.Field
Dim sData As String
Set paf = CreateObject ("nbPAFSearchR.PafSearchR")
Set rsAddresses = paf.DoPafSearch(FullPostCode, BuildingNo, "", "", "", "", "", 80, True, 100, True)
Open PrintFile For Append As #1 ' Open outputfile for append.
Set rsNames = paf.GetNames
rsAddresses.RecordCount & ")")
sData = ""
For Each fld In rsAddresses.Fields
sData = sData & fld.Name & ", "
Next
Do Until rsAddresses.EOF
sData = ""
For Each fld In rsAddresses.Fields
sData = sData & fld.Value & ", "
Next
' Call Trace(sData)
rsAddresses.MoveNext
Print #1, sData; 'prints address
Loop
Do somebody know how to get data out of a recordset and into variables? As you can see in the code below, I do a loop on the recordset, and make a print. My problem is that I want to get the each value/field in the recordset into variables first, so I can print it in the order i want afterwords. Now do i get everything into sData variable, and then i am not able to change the order of fields when i do a print...
Do you have a suggestion? Thankful for all answers!
Dim rsAddresses As ADODB.Recordset
Dim rsNames As ADODB.Recordset
Dim paf As PafSearchR
Dim fld As ADODB.Field
Dim sData As String
Set paf = CreateObject ("nbPAFSearchR.PafSearchR")
Set rsAddresses = paf.DoPafSearch(FullPostCode, BuildingNo, "", "", "", "", "", 80, True, 100, True)
Open PrintFile For Append As #1 ' Open outputfile for append.
Set rsNames = paf.GetNames
rsAddresses.RecordCount & ")")
sData = ""
For Each fld In rsAddresses.Fields
sData = sData & fld.Name & ", "
Next
Do Until rsAddresses.EOF
sData = ""
For Each fld In rsAddresses.Fields
sData = sData & fld.Value & ", "
Next
' Call Trace(sData)
rsAddresses.MoveNext
Print #1, sData; 'prints address
Loop