updating record
I have a bound form and each time the form closes I want to select a group of records and and number then startiing from one. I am using the procedure below but it is not working.
Each time I run the procedure it locks up Access probably because of continuous loop. How do I do this
Dim str As String
Dim recSet As ADODB.Recordset
Dim conn As ADODB.Connection
str = "SELECT tblDelivery.DeliveryID, tblDelivery.DeliveryNumber " & _
"FROM tblDelivery " & _
"WHERE tblDelivery.DealershipID = " & [Forms]![frmSwitchboard]![lstDlr]
Set recSet = New ADODB.Recordset
Set conn = CurrentProject.Connection
recSet.Open str, conn, adOpenKeyset, adLockOptimistic, adCmdText
Do Until recSet.EOF
recSet!DeliveryNumber = recSet!DeliveryNumber + 1
recSet.Update
Loop
|