Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Other Programming > VBScript
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 8th, 2005, 01:55 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default Moving through a Do Loop

Okay, this should be simple but I can't find out how to do it.

I have a Do Loop. There is a counter and the loop runs until the counter reaches a certain number.

One of the things the loop does is look up some records in a database on each pass, but if there are no records, I want the loop to cycle prematurely. I can't get VBScript to allow me to do this.

This is sort of what I want to do but the syntax doesn't work:

'=====
Do Until i = 20
'open recordset
   If objRecordset.RecordCount = 0 Then
    i = i + 1
    Loop
   Else
    ...
   End If
i = i + 1
Loop
'=====

It's that Loop in the If Then End If statement that is not working. I get a Loop without Do error and the script won't run.

I am sure one of you has a very elegant solution. I am looking forward to smacking myself in the forehead for not thinking of it.

Thanks,



mmcdonal
__________________
mmcdonal

Look it up at: http://wrox.books24x7.com
Reply With Quote
  #2 (permalink)  
Old April 8th, 2005, 02:10 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

SMACK!

Okay, I'm glad I figured this out before anyone read this.

I just removed the Loop from the first condition and it works.

Egads, what a newbtard I am.



mmcdonal
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving viewport schoolBoy Javascript How-To 7 March 7th, 2007 05:03 PM
Moving a file pakman Excel VBA 2 January 14th, 2005 10:49 AM
Need help moving my database seanmayhew BOOK: ASP.NET Website Programming Problem-Design-Solution 1 December 30th, 2004 05:00 PM
moving a column p_gauri7 Crystal Reports 6 December 20th, 2004 03:27 PM
nested while loop doesn't loop hosefo81 PHP Databases 5 November 12th, 2003 08:46 AM



All times are GMT -4. The time now is 07:49 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.