Dim zd2 As Integer, zd1 As String, bj As String, js As Long
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
zd2 = 1
bj = ""
zd1 = ""
js = 1
Set cnn = CurrentProject.Connection
Set rst = New ADODB.Recordset
sql = "select * from 试验表"
rst.Open sql, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Do While js < rst.RecordCount
If zd2 <= 30 And bj = zd1 Then
rst!座位号 = zd2
zd2 = zd2 + 1
Else
zd2 = 1
rst!座位号 = zd2
zd2 = zd2 + 1
End If
zd1 = rst!试卷代码
rst.Update
rst.MoveNext
bj = rst!试卷代码
js = js + 1
Loop
应该有更简捷的办法,不过我是这样实现的