Data1.Refresh
Command2.Enabled = True
End If
End Sub
Private Sub Command2_Click()
Dim d
d = MsgBox("是否真的删除吗?", vbYesNo + vbQuestion, "删除")
If d = vbYes Then
Data1.Recordset.Delete
Data1.Recordset.MoveNext
If Data1.Recordset.EOF = True Then
Command4.Enabled = False
Data1.Recordset.MovePrevious
If Data1.Recordset.BOF = True Then
Command3.Enabled = False
End If
End If
End If
Data1.Refresh
End Sub
Private Sub Command3_Click()
Data1.Recordset.MovePrevious
If Data1.Recordset.BOF Then
Command3.Enabled = False
Data1.Recordset.MoveNext
Else
Command3.Enabled = True
End If
Command4.Enabled = True
End Sub
Private Sub Command4_Click()
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then
Command4.Enabled = False
Data1.Recordset.MovePrevious
Else
Command4.Enabled = True
End If
Command3.Enabled = True
End Sub
Private Sub Command5_Click()
If Text1.Locked = True Or Text2.Locked = True Or Text3.Locked = True Or Text4.Locked = True Or Text5.Locked = True Then
Text1.Locked = False
MsgBox "请输入查找编号"
Text1.Text = ""
Text1.SetFocus
Else
Dim a
a = "单据编号=" & "'" & Text1.Text & "'"
Data1.Recordset.FindFirst a
If Data1.Recordset.NoMatch Then
MsgBox "没有此记录"
Else
Text1.Locked = True
End If
End If
End Sub
Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\db.mdb"
Data1.Refresh
Me.Width = 10560
Me.Height = 7650
If Data1.Recordset.EOF Then
Command2.Enabled = False
End If
End Sub
6.1.4房屋及住户管理
运行效果:
图6.5房屋及住户资料管理界面
代码:
Private Sub Command1_Click()
If Command1.Caption = "添 加" Then
Command1.Caption = "保 存"
Data1.Recordset.AddNew
Text1.Locked = False
Text1.SetFocus
Command2.Enabled = False
Exit Sub
Else
Text1.Locked = True
Data1.Recordset.Update
Data1.Recordset.MoveLast
Command1.Caption = "添 加"
Data1.Refresh
Command2.Enabled = True
End If
End Sub
Private Sub Command2_Click()
Dim d
d = MsgBox("是否真的删除吗?", vbYesNo + vbQuestion, "删除")
If d = vbYes Then
Data1.Recordset.Delete
Data1.Recordset.MoveNext
If Data1.Recordset.EOF = True Then
Command4.Enabled = False
Data1.Recordset.MovePrevious
If Data1.Recordset.BOF = True Then
Command3.Enabled = False
Command2.Enabled = False
End If
End If
End If
Data1.Refresh
End Sub
Private Sub Command3_Click()
Data1.Recordset.MovePrevious
If Data1.Recordset.BOF Then
Command3.Enabled = False
Data1.Recordset.MoveNext
Else
Command3.Enabled = True
End If
Command4.Enabled = True
End Sub
Private Sub Command4_Click()
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then
Command4.Enabled = False
Data1.Recordset.MovePrevious
Else
Command4.Enabled = True
End If
Command3.Enabled = True
End Sub
Private Sub Command5_Click()
If Text1.Locked = True Or Text2.Locked = True Or Text3.Locked = True Or Text4.Locked = True Or Text5.Locked = True Then
Text1.Locked = False
Text5.Locked = False
MsgBox "请输入查找编号"
Text1.Text = ""
Text1.SetFocus
Else
Dim a
a = "楼宇单元=" & "'" & Text1.Text & "'"
Data1.Recordset.FindFirst a
If Data1.Recordset.NoMatch Then
MsgBox "没有此记录"
Else
Text1.Locked = True
End If
End If
End Sub
Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\db.mdb"
Data1.Refresh
Me.Width = 10935
Me.Height = 7830
If Data1.Recordset.EOF Then
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
End If
Text1.Locked = True
End Sub
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>