谢谢老师,我这样做的,初试了下还是对的
Dim result As Dialogresult
result = messagebox.Show("确认整下?...","提示",MessageBoxbuttons.yesno,MessageBoxicon.question)
If result = dialogresult.yes Then
Dim s1,s2,s3 As Integer
s1 = 1
s2 = 1
s3 = 0
For Each dr As DataRow In DataTables("凭证记录表").Select ("工作日期 = '" & da & "'","工作日期")
If dr("凭证号") = s1 Then
s2= dr("凭证号")
Else
If dr("凭证号") = s2+1 Then
s1 = s1 + 1
Else
If dr("凭证号") = s3 Then
dr("凭证号") = s1
Else
s3= dr("凭证号")
dr("凭证号") = s1+1
s1 = s1 + 1
End If
End If
End If
Next
Else
Return
End If