按钮代码如下:
Option Compare Database
Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
Dim x As Long
Dim b As Integer
Dim c As Integer
x = DLookup("[序号]", "信访登记台账", "[序号] =" & DLast("[序号]", "信访登记台账"))
b = Left(x, 4)
c = Format(Now, "yyyy")
If b = c Then
DoCmd.GoToRecord , , acNewRec
序号.SetFocus
序号.DefaultValue = x + 1
ElseIf b <> c Then
DoCmd.GoToRecord , , acNewRec
序号.SetFocus
序号.DefaultValue = Format(Now, "yyyy") & "0001"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_Command6_Click:
Exit Sub
Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click
End If
End Sub
上面哪错了啊???恳请指教