Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > Loop


Reply
 
Thread Tools Display Modes
  #1  
Old 05-01-2005, 02:16 AM
riskyinred riskyinred is offline
Newcomer
 
Join Date: Apr 2005
Posts: 5
Default Loop


I'm getting a bit stuck with this loop as it never moves on to the next record in the table, so that the CallCost field can be calculated for it, and so on until EOF. Can anybody help me?



Do Until rstBaseTable.EOF

MidTextTel = Mid$(iTelNum, 1, 3)
dtaPaymentTable.Refresh

Set rstPaymentTable = dbsPhone.OpenRecordset("SELECT CallPrice FROM PAYMENT WHERE CallPrefix = '" & MidTextTel & "'")
PriceAsInteger = CSng(txtCallPrice.Text)
Debug.Print PriceAsInteger; "PRICEASINTEGER"

Set rstBaseTableCalc = dbsPhone.OpenRecordset("SELECT Duration " _
& "FROM BASE " _
& "WHERE TelNum Like ' & MidTelText &*';")

dtaBaseTable.Refresh
DurationAsString = CStr(txtDurationBase.Text)
CallCost = PriceAsInteger * DurationAsString

AddCallCost rstBaseTableAdding, CallCost

If rstBaseTable.RecordCount > 0 Then

rstBaseTable.MoveNext

End If



Thanks
Reply With Quote
  #2  
Old 05-01-2005, 07:59 AM
reboot's Avatar
reboot reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
Default

Take out the line

If rstBaseTable.RecordCount > 0 Then and the End If that goes with it.
__________________
~ Quod non mortiferum, fortiorem me facit ~

Avatar by lebb
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->