TheSwamp
Code Red => VB(A) => Topic started by: dr-j 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
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
-
I didn't analyse the code in detail, but 'while' isn't closed by 'wend'
Cheers
-
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