Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with some ADO 1

Status
Not open for further replies.

Cenedra

Programmer
Jan 2, 2003
114
US
Hi, this is what I am trying to do, and I know I am stuck at a really simple impass.

I am populating my recordset with a select statement.

What I want to do is -

For each record in the recordset


' do some stuff

Next


but I try to do this with record being a record object, and I get a message saying that the object doesn't support that method.

How else do I go about stepping through each row of the recordset?

Thanks for your help!
 
post your code and note which line is giving you
the problem.
 
Dim conn As Connection
Dim strSQL As String ' Select statement for data for TaxBill table
Dim strTemp As String 'string for building carat delimited line of text
Dim rec As Record

Dim rsTaxBillData As Recordset

Set conn = New Connection
Set rsTaxBillData = New Recordset


conn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=WarrickTax;Data Source=(local)"

strSQL = "SELECT mpropertyNumber, mmapNumber, mbillNumber, mtaxYear, mtaxRate, mhomesteadCreditRate," & _
"mreplacementCreditRate, munit1AmountTotal, mgrossResAmount1, mresReplacementCreditAmount1," & _
"mresHomesteadCreditAmount1, mresNetTaxAmount1, mgrossNonResAmount1, mnonResReplacementCreditAmount1," & _
"mnonResNetTaxAmount1, mnetTaxAmount1, mlateAssessmentPenalty1, mlateAssessmentInterest1," & _
"mdelinquentTaxAmount, mdelinquentPenaltyAmount, mtotalDelqTaxPenaltyAmount, mtotalPrepaymentAmount1," & _
"mtotalAmountDue1, mspringInstallmentDueDate, mfallInstallmentDueDate, munit2AmountTotal, mgrossResAmount2," & _
"mresReplacementCreditAmount2, mresHomesteadCreditAmount2, mresNetTaxAmount2, mgrossNonResAmount2," & _
"mnonResReplacementCreditAmount2, mnonResNetTaxAmount2, mnetTaxAmount2, mlateAssessmentPenalty2," & _
"mlateAssessmentInterest2 , mtotalPrepaymentAmount2, mtotalAmountDue2, mpaymentAmount1, mpaymentAmount2 From T_MVPTSTTaxBill"

rsTaxBillData.Open strSQL, conn

Open "C:\tblRETaxBills.txt" For Output As #1

rsTaxBillData.MoveFirst

For Each rec In rsTaxBillData <=-- Error here. Run-time error 438: Object doesn't support the property or method

'Do stuff

Next


Close #1
rsTaxBillData.Close
conn.Close
 
You can get around this by using:

rsTaxBillData.MoveFirst
While not rsTaxBillData.EOF
'do stuff
rsTaxBillData.MoveNext
Wend

Use that instead of:
For Each rec In rsTaxBillData

'Do stuff

Next
 
thank you hoggle.

Can you tell me why the For Each won't work? Is ADO just not set up to approach it that way?

thanks again
 
Mangro, thank you too, didn't see your post up there :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top