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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
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 |