Author Topic: trouble defyning loop  (Read 2544 times)

0 Members and 1 Guest are viewing this topic.

dr-j

  • Guest
trouble defyning loop
« on: February 17, 2006, 10:42:12 PM »
Hi,
i have a problem defyning a loop in my application.
the situation is like this:
i'm making a calculation in acad that takes some numbers from a recordset in access.

the global thing should be something like this:
'calculation'
when X < Y then pick the next row of the recordset and make the calculation again with the new values.
when X > Y print text that values are sufficient.

the code i have right now looks like this.
it has some big flaws in it I think... could someone help me out on it?

would be great  :-D

Code: [Select]
Do Until rstobj.EOF
        While Me.TextBox4.Value > Me.TextBox5.Value
        rstobj.MoveNext
    Loop
   
    If Me.TextBox4.Value < Me.TextBox5.Value Then
    MsgBox "calculation ok"
    End If

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: trouble defyning loop
« Reply #1 on: February 18, 2006, 05:45:16 AM »
I didn't analyse the code in detail, but 'while' isn't closed by 'wend'

Cheers
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

ChuckHardin

  • Guest
Re: trouble defyning loop
« Reply #2 on: February 20, 2006, 10:36:21 AM »
If rstobj.BOF=False Then rstobj.MoveFirst
Do Until rstobj.EOF
     If Me.TextBox4.Value > Me.TextBox5.Value Then
          'Do your calculations here   
          rstobj.MoveNext
     ElseIf Me.TextBox4.Value < Me.TextBox5.Value Then
          MsgBox "calculation ok"
          rsobj.MoveLast
     Else
          ' Me.TextBox4.Value = Me.TextBox5.Value     
     End If
Loop