rpow = "guest" Then
Frame2.Enabled = False
End If
Exit Sub
loaderror:
MsgBox Err.Description
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set DataGrid1.DataSource = Nothing
End Sub
窗体名:Form3
代码:
Private Sub Command1_Click()
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = True
Command5.Enabled = True
DataGrid1.AllowAddNew = True
DataGrid1.AllowUpdate = True
Exit Sub
command1error:
MsgBox Err.Description
End Sub
Private Sub Command2_Click()
On errror GoTo Command2
Command1.Enabled = False
Command3.Enabled = False
Command2.Enabled = False
Command1.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
DataGrid1.AllowUpdate = True
Command2:
If Err.Number <> 0 Then
MsgBox Err.Description
End If
End Sub
Private Sub Command3_Click()
Dim answer As String
On Error GoTo command3error
answer = MsgBox("确定要删除吗?", vbYesNo, "")
If answer = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF = True Then
Adodc1.Recordset.MoveLast
End If
DataGrid1.Refresh
MsgBox "成功删除!", vbOKCancel + vbExclamation, ""
DataGrid1.AllowDelete = False
Else
Exit Sub
End If
command3error:
If Err.Number <> 0 Then
MsgBox Err.Description
End If
End Sub
Private Sub Command4_Click()
If Not IsNull(DataGrid1.Bookmark) Then
DataGrid1.Refresh
End If
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = False
Command5.Enabled = False
DataGrid1.AllowAddNew = False
DataGrid1.AllowUpdate = False
MsgBox "操作成功!", vbOKCancel + vbExclamation, ""
End Sub
Private Sub Command5_Click()
DataGrid1.Refresh
DataGrid1.AllowAddNew = False
DataGrid1.AllowUpdate = False
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = False
Command5.Enabled = False
End Sub
Private Sub Form_Load()
Command4.Enabled = False
DataGrid1.AllowAddNew = False
DataGrid1.AllowDelete = False
DataGrid1.AllowUpdate = False
If userpow = "guest" Then
Frame2.Enabled = False
End If
Exit Sub
loaderror:
MsgBox Err.Description
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set DataGrid1.DataSource = Nothing
End Sub
窗体名:Form4
代码:
Private Sub Command1_Click(Index As Integer)
Dim sql As String
If Check1.Value = vbChecked Then
sql = "书名" & Trim(Text1.Text & " ") & "'"
End If
If Check2.Value = vbcheckde Then
If Trim(sql) = "" Then
sql = "类别='" & Trim(Combo1.Text & " ") & "'"
&n