|
Dim stemp As String
Dim i As Integer
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
stemp = "select * from 报表 where id = " & Me.Text8
rs.Open stemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If rs.RecordCount = 0 Then
MsgBox "无修改记录", vbCritical, "提示"
Exit Sub
End If
rs.Delete
rs.Update
MsgBox "删除成功", vbExclamation, "提示"
Me![报表查询].Requery
Set rs = Nothing
'以上是删除
'以下是修改
If Me.Command2.Caption = "修改" Then
Me.板号.Visible = False
Me.日期.Visible = False
Me.组别.Visible = False
Me.工号.Visible = False
Me.姓名.Visible = False
Me.号数.Visible = False
Me.级别.Visible = False
Me.面数.Visible = False
Me.中数.Visible = False
Me.颜色.Visible = False
Me.数量.Visible = False
Me.Text1.Visible = False
Me.Text2.Visible = False
Me.Text3.Visible = False
Me.Command1.Enabled = False
Me.Command3.Enabled = False
Me.Command2.Caption = "保存"
Else
Dim stemp As String
Dim i As Integer
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
stemp = "select * from 报表 where id=" & Me.Text8
rs.Open stemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If rs.RecordCount = 0 Then
MsgBox "无修改记录", vbCritical, "提示"
Exit Sub
End If
rs("日期") = Me![txt日期]
rs("工号") = Me![txt工号]
rs("组别") = Me![txt组别]
rs("姓名") = Me![txt姓名]
rs("号数") = Me![txt号数]
rs("级别") = Me![txt级别]
rs("面数&厚薄") = Me![txt面数]
rs("板号") = Me![txt板号]
rs("中数") = Me![txt中数]
rs("颜色") = Me![txt颜色]
rs("数量") = Me![txt数量]
rs.Update
Me![报表查询].Requery
MsgBox "修改成功", vbExclamation, "提示"
rs.Close
Set rs = Nothing
Me.板号.Visible = True
Me.日期.Visible = True
Me.组别.Visible = True
Me.工号.Visible = True
Me.姓名.Visible = True
Me.号数.Visible = True
Me.级别.Visible = True
Me.面数.Visible = True
Me.中数.Visible = True
Me.颜色.Visible = True
Me.数量.Visible = True
Me.Text1.Visible = True
Me.Text2.Visible = True
Me.Text3.Visible = True
Me.日期.SetFocus
Me.Command1.Enabled = True
Me.Command3.Enabled = True
Me.Command2.Caption = "修改"
|
|