|
Private Sub 命令36_Click()
Dim rst As Recordset, db As Database, I As Long
Set db = CurrentDb()
Set rst = db.OpenRecordset("表1")
For I = 1 To 8
If IsNull(Me("MC" & I)) = False Then
If IsNull(Me("DM")) = True Then
MsgBox "必须输入单位名称"
Exit Sub
End If
If IsNull(Me("XSY")) = True Then
MsgBox "必须输入经营主管"
Exit Sub
End If
If IsNull(Me("RQ")) = True Then
MsgBox "必须输入日期"
Exit Sub
End If
rst.AddNew
rst![DM] = Me("DM")
rst![日期] = Me("RQ")
rst![名称] = Me("MC" & I)
rst![规格] = Me("GG" & I)
rst![单位] = Me("DW" & I)
rst![数量] = Me("SL" & I)
rst![单重] = Me("DZ" & I)
rst![总重] = Me("ZZ" & I)
rst![单价] = Me("DJ" & I)
rst![金额] = Me("JE" & I)
rst![备注] = Me("BZ" & I)
rst![经营主管] = Me("XSY")
rst![保管员] = Me("BGY")
rst![开票人] = Me("KPR")
rst![编号] = Me("BH")
rst.Update
End If
Next I
MsgBox "保存成功"
DoCmd.GoToControl ("DM")
Me.命令36.Enabled = True
End Sub
怎样在保存后重新打开窗体,让DM字段为空,编号自动加1, 谢谢
|
|