View Full Version : Move


fredfortsonsr
05-31-2001, 08:46 PM
I'm reviewing some code by another programmer (again) and am trying to make sense of his intentions.

Could someone tell me what this may mean?

PressureTable.Move Record - 1

I am assuming it means go back one record. But surely he knew that he was already at the 1st record?

Here's the source:
----------------------------

PressureTable.MoveFirst
' Read the Pressure Table, go to the first record and count the number of records.
' Setting Top pressure to the absolute value
For Counter = 1 To PressureTable.RecordCount
PressureNumber = PressureTable.Fields("PSI Number")
' If the absolute value of (Top Pressure - the PSI number) is less than 20000
' Set the variable NUMBER to that value rather than 20000.
If Abs(TopPressure - PressureNumber) < Number Then
Number = Abs(TopPressure - PressureNumber)
Record = Counter
End If
' Proceed to the next record.
PressureTable.MoveNext
Next

PressureTable.MoveFirst
PressureTable.Move Record - 1
If Left(GasName, 7) = "METHANE" Then GasName = Left(GasName, 7)
If PressureTable.Fields(GasName) = "" Or Err = 3265 Then GasName = "NITROGEN"
Moles = PressureTable.Fields(GasName)
PressureNumber = PressureTable.Fields("PSI Number")
---------------------------
Answers are surely appreciated.

Fred

D-Fresh
06-01-2001, 06:10 AM
Fred,

The move method is used to move to a certain absolute row in a recordset... In this case, the programmer was checking the pressure and if it met the condition, he increased his counter(the variable Record). Then the line PressureTable.move Record-1 will go to the row before what the variable Record is set to.... The correct syntax for this method is...

recordset.move rows, start

Hope that helps..

Doug