A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Stuck in an Infinite Loop



 
 
Thread Tools Display Modes
  #1  
Old July 6th, 2005, 07:46 PM
Sharkbyte
external usenet poster
 
Posts: n/a
Default Stuck in an Infinite Loop

Okay, folks...

I can not, for the life of me, see where my mistake is. I need another set
of eyes.

I am trying to loop through a Case statement, and want the loop to exit once
my variable reaches a specific value (36). Here is my most recent version of
code:

Dim outcome1 As Double
outcome1 = [Forms]![subfrmtestbetpercfix1]![outcomeid]

If outcome1 36 Then
Do Until outcome1 = 36

Select Case outcome1
Case 31
DoCmd.RunSQL ("update ...
Case 32
DoCmd.RunSQL ("update ...
Case 33
DoCmd.RunSQL ("update ...
Case 34
DoCmd.RunSQL ("update ...
Case 35
DoCmd.RunSQL ("update ...
End Select

Loop
Else
End If

The Update statement(s) work properly, but as the title states, the loop
continues, even after the variable reaches 36. I know it should be slapping
me in the face, but I'm just not seeing the problem.

Thanks, in advance.

Sharkbyte
  #2  
Old July 6th, 2005, 08:41 PM
Sharkbyte
external usenet poster
 
Posts: n/a
Default

Answered my own question. =P

For whatever reason it never dawned on me to move enclose everything inside
the Do Until/Loop.

Thanks.

Sharkbyte


"Sharkbyte" wrote:

Okay, folks...

I can not, for the life of me, see where my mistake is. I need another set
of eyes.

I am trying to loop through a Case statement, and want the loop to exit once
my variable reaches a specific value (36). Here is my most recent version of
code:

Dim outcome1 As Double
outcome1 = [Forms]![subfrmtestbetpercfix1]![outcomeid]

If outcome1 36 Then
Do Until outcome1 = 36

Select Case outcome1
Case 31
DoCmd.RunSQL ("update ...
Case 32
DoCmd.RunSQL ("update ...
Case 33
DoCmd.RunSQL ("update ...
Case 34
DoCmd.RunSQL ("update ...
Case 35
DoCmd.RunSQL ("update ...
End Select

Loop
Else
End If

The Update statement(s) work properly, but as the title states, the loop
continues, even after the variable reaches 36. I know it should be slapping
me in the face, but I'm just not seeing the problem.

Thanks, in advance.

Sharkbyte

 




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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop Problems Debra Farnham General Discussion 1 July 1st, 2005 03:34 AM
Records in relational tables Shawn Database Design 5 June 18th, 2005 12:47 AM
Newbee - how to loop through table and delete unwanted records Newbee Adam New Users 2 March 8th, 2005 09:33 PM
How to write a nested loop using sql cursors Paul Using Forms 3 January 12th, 2005 01:13 PM
Loop help cwilson General Discussion 4 October 18th, 2004 05:35 PM


All times are GMT +1. The time now is 11:39 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.