|
如不想直接改,代码里改也可以
Private Sub Command0_Click()
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE 行内机构 SET 行内机构.内机构编号 = Null"
DoCmd.SetWarnings True
CurrentDb.QueryDefs("行内").SQL = "SELECT 行内机构.机构编号, 行内机构.内机构编号 FROM 行内机构 WHERE 行内机构.机构编号 Is Not Null ORDER BY 行内机构.机构编号"
Set yy = CurrentDb.OpenRecordset("行内", 2)
Do While Not yy.EOF
kk = DCount("*", "行内", yy.Fields(0).Name & "='" & yy.Fields(0) & "'")
For i = 1 To kk
yy.Edit
yy.Fields(1) = yy.Fields(0) & Format(i, "00")
yy.Update
yy.MoveNext
Next
Loop
End Sub |
|