Private Sub 广告类型_AfterUpdate()
On Error GoTo Err_广告类型_Click
Dim myrecordset, mylookup As Variant
Dim number As Variant
'DoCmd.GoToRecord , , acNewRec
'If MsgBox("您确定要新编号吗?选是将编新号,而且不能更改和删除", vbYesNo, "关闭!") = vbNo Then
'End
'End If
mylookup = DLookup("类型代码", "广告资源编号")
If IsNull(mylookup) Then
Set myrecordset = CurrentDb.OpenRecordset("广告资源编号")
myrecordset.AddNew
myrecordset("类型代码") = Me.广告类型.Value
myrecordset("广告编号") = 1
myrecordset.Update
number = 1
'End If
Else
Set myrecordset = CurrentDb.OpenRecordset("广告资源编号")
number = myrecordset("广告编号") + 1
myrecordset.Edit
myrecordset("广告编号") = number
myrecordset.Update
'ElseIf Format(mylookup, "yyyy/mm") < Format("广告编号", "yyyy/mm") Then
'Set myrecordset = CurrentDb.OpenRecordset("广告资源编号")
'myrecordset.Edit
'myrecordset("类型代码") = Me.广告类型.Value
'myrecordset("广告编号") = 1
'myrecordset.Update
'number = 1
End If