|
Option Compare Database
Dim I As Integer
Dim a As Integer
Private Sub 确定_Click()
I = Me.Frm_nka.Form.CurrentRecord
Dim Strsql0 As String
Dim Strsql1 As String
Strsql0 = "UPDATE nka SET Y/N =" & Me![Y/N] & ",KJZG =" & Me![KJZG] & ",FKRQ =" & Me![FKRQ] & " WHERE NO=" & Me![NO]
Strsql1 = "DELETE NO FROM nka WHERE NO=" & Me![NO]
If a = 1 Then
CurrentProject.Connection.Execute Strsql0
Me.Frm_nka.Form.Requery
MsgBox "已成功修改资料", vbInformation, "提示"
Me.Frm_nka.Form.Recordset.Move I
End If
If a = 2 Then
CurrentProject.Connection.Execute Strsql1
Me.Frm_nka.Form.Requery
MsgBox "已成功删除资料", vbInformation, "提示"
If I <> 1 Then
Me.Frm_nka.Form.Recordset.Move I - 1
End If
End If
a = 0
Call FrmEnabled
End Sub
Private Sub 删除_Click()
a = 2
Call FrmEnabled
End Sub
Private Sub 修改_Click()
a = 1
Call FrmEnabled
End Sub
Private Sub Form_Load()
Call FrmEnabled
End Sub
Public Sub FrmEnabled()
Select Case a
Case Is = 0
Me.删除.Enabled = True
Me.修改.Enabled = True
Me.修改.SetFocus
Me.确定.Enabled = False
Me.FKRQ.Locked = True
Me.KJZG.Locked = True
Me.Y_N.Locked = True
Case Is = 1
Me.确定.Enabled = True
Me.删除.Enabled = False
Me.确定.SetFocus
Me.修改.Enabled = False
Me.FKRQ.Locked = False
Me.KJZG.Locked = False
Me.Y_N.Locked = False
Case Is = 2
Me.确定.Enabled = True
Me.修改.Enabled = False
Me.确定.SetFocus
Me.删除.Enabled = False
Me.FKRQ.Locked = True
Me.KJZG.Locked = True
Me.Y_N.Locked = True
End Select
End Sub |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|