Private Sub Form_BeforeUpdate(Cancel As Integer)
If Nz(ID) = 0 Then ' id没填时跳号
Dim Rst2TBDBVEN As New ADODB.Recordset
Dim strSQL As String
strSQL = "SELECT TOP 25 Max(表1.ID) AS ID之Max FROM 表1"
Rst2TBDBVEN.Open strSQL, CurrentProject.Connection, adOpenStatic
If Rst2TBDBVEN.RecordCount > 0 Then
ID = rst(0) + 1
Else
ID = 1 '第一个纪录为空时
End If
End If