guys I would like some advice on how I can loop while updating the database
I would like to move through an integer field in the database This field would typically look like this:
ShiftNumbers
195
195
196
196
197
197
198
198
I would like to move through this field and update this field so that instead of these values having a difference of 1 between them I would like to increase the difference to 10 so that it would look like this
205
205
216
216
227
227
238
238
So far I have tried using this code, and its not quite doing the Job, any help
I would like to move through an integer field in the database This field would typically look like this:
ShiftNumbers
195
195
196
196
197
197
198
198
I would like to move through this field and update this field so that instead of these values having a difference of 1 between them I would like to increase the difference to 10 so that it would look like this
205
205
216
216
227
227
238
238
So far I have tried using this code, and its not quite doing the Job, any help
Code:
Private Sub btnIncreament_Click()
Dim myShiftNumber As Integer
Dim CounterOne As Integer
Dim CounterTwo As Integer
Dim I As Integer
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM Outwards", con, adOpenKeyset, adLockOptimistic, adCmdText
rs.MoveFirst
While Not rs.EOF
' If (Trim(txtContractCode.Text) & "-" & Trim(rs!Product_Code) = rst!ShiftNumber) Then
If I = 0 Then
I = 1
End If
If (rs!ChequeNumber = rs!shiftnumber) Then
rs!shiftnumber = rs!shiftnumber + (10 * I)
rs.Update
If (rs!ChequeNumber <> rs!shiftnumber) Then
rs!shiftnumber = rs!shiftnumber + (10 * I)
rs.Update
End If
End If
myShiftNumber = rs!shiftnumber
rs.MoveNext
Wend
End Sub