📄 frm_fwinfo.frm
字号:
Height = 330
Left = 945
Top = 720
Visible = 0 'False
Width = 1635
_ExtentX = 2884
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\程序修改\小区物业管理系统\db_wygl.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\程序修改\小区物业管理系统\db_wygl.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from tab_fwinfo"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Attribute VB_Name = "frm_fwinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim myval As Integer '定义变量
Dim KeyCode '定义变量
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click() '取消
'清空文本框
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text13.Text = ""
'设置控件状态
CmdSave.Enabled = False
Command1.Enabled = False
Command5.Enabled = True
End Sub
Private Sub CmdSave_Click() '保存
If Combo1.Text = "" Or Text6.Text = "" Or Text7 = "" Or Text8 = "" Or Text9 = "" Or Text5 = "" Then
MsgBox "输入信息不允许为空!", , "系统提示"
Exit Sub
End If
If Not IsNumeric(Text6.Text) Then
'IsNumeric 函数返回 Boolean 值,指出表达式的运算结果是否为数。
MsgBox "输入的数据类型不正确,请重新输入!", , "系统提示"
Exit Sub
End If
If Not IsNumeric(Text7.Text) Then
MsgBox "输入的数据类型不正确,请重新输入!", , "系统提示"
Exit Sub
End If
If Not IsNumeric(Text8.Text) Then
MsgBox "输入的数据类型不正确,请重新输入!", , "系统提示"
Exit Sub
End If
If Not IsNumeric(Text9.Text) Then
MsgBox "输入的数据类型不正确,请重新输入!", , "系统提示"
Exit Sub
End If
Adodc1.RecordSource = "select * from tab_fwinfo where 房间编号='" + Text1.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.Fields("房间编号") = Text1.Text
Adodc1.Recordset.Fields("单元") = Text2.Text
Adodc1.Recordset.Fields("楼层") = Text3.Text
Adodc1.Recordset.Fields("用途") = Text5.Text
Adodc1.Recordset.Fields("建筑面积") = Text6.Text
Adodc1.Recordset.Fields("使用面积") = Text7.Text
Adodc1.Recordset.Fields("公产面积") = Text8.Text
Adodc1.Recordset.Fields("私产面积") = Text9.Text
Adodc1.Recordset.Fields("备注") = Text10.Text
Adodc1.Recordset.Fields("小区名称") = Text12.Text
Adodc1.Recordset.Fields("大楼名称") = Text13.Text
Adodc1.Recordset.Fields("朝向") = Text14.Text
Adodc1.Recordset.Fields("房屋状态") = Combo1.Text
Adodc1.Recordset.Fields("权属类型") = Text15.Text
Adodc1.Recordset.Fields("房间结构") = Text16.Text
Adodc1.Recordset.Fields("配备设施") = Text17.Text
Adodc1.Recordset.Fields("房间类别") = Text18.Text
On Error Resume Next
Adodc1.Recordset.Update
MsgBox "数据修改成功!", , "系统提示"
Unload Me
End If
' Set adors = cn.Execute("insert into tab_fwinfo values('" & Text1 & "','" & Text12 & "','" & Text13 & "','" & Text2 & "','" & Text3 & "','" & Text15 & "','" & Text14 & "','" & Text16 & "','" & Text5 & "','" & Text18 & "','" & Text17 & "','" & Combo1 & "','" & Text6 & "','" & Text7 & "','" & Text8 & "','" & Text9 & "','" & Text10 & "') ")
'' Dim rs1 As New ADODB.Recordset
' rs1.Open "select * from tab_yzinfo where 业主代号='" + Text1.Text + "'", cn, adOpenKeyset, adLockOptimistic
' If rs1.RecordCount > 0 Then
' rs1.Fields("业主姓名") = Text4.Text
' rs1.Update
' Else
' rs1.AddNew
' rs1.Fields("业主代号") = Text1.Text
'' rs1.Fields("业主姓名") = Text4.Text
' rs1.Fields("购入房编号") = Text1.Text
' rs1.Fields("小区名称") = Text12.Text
' rs1.Fields("大楼名称") = Text13.Text
' rs1.Fields("房间号码") = Right(Text1.Text, 4)
'
' If Combo1.Text = "入住" Then
' Dim rs2 As New ADODB.Recordset
' rs2.Open "select * from tab_rkinfo order by 人口编号", cn, adOpenKeyset, adLockOptimistic
' If rs2.RecordCount = 0 Then
' rs2.AddNew
' rs2.Fields("人口编号") = "rk001"
' Else
' Dim rs3 As New ADODB.Recordset
' rs3.Open "select * from tab_rkinfo order by 人口编号", cn, adOpenKeyset, adLockOptimistic
' If rs3.RecordCount > 0 Then
' rs2.AddNew
' If rs3.EOF = False Then
' rs3.MoveLast
' rs2.Fields("人口编号") = "rk" + Format(Val(Right(rs3.Fields("人口编号"), 3)) + 1, "###000")
' Else
' rs2.Fields("人口编号") = "rk" + Format(Val(Right(rs3.Fields("人口编号"), 3)) + 1, "###000")
' End If
' End If
' End If
'' rs2.Fields("姓名") = Text4.Text
' rs2.Fields("小区名称") = Text12.Text
' rs2.Fields("大楼名称") = Text13.Text
' rs2.Fields("房间编号") = Text1.Text
' rs2.Fields("房间号") = Right(Text1.Text, 4)
' rs2.Fields("与户主关系") = "户主"
' rs2.Update
'
' rs1.Fields("是否进住") = "已进住"
' Else
' rs1.Fields("是否进住") = "未进住"
' End If
' rs1.Update
' End If
' MsgBox "数据保存成功", , "系统提示"
Unload Me
frm_fwinfo.Show
' frm_fwxx.Adodc1.Recordset.Delete
' Unload frm_fwxx
' Adodc1.Refresh
'设置控件状态
CmdSave.Enabled = False
Command1.Enabled = False
Command5.Enabled = True
End Sub
Private Sub Command2_Click() '退出
Frm_main.Show
Unload Me
Me.Hide
End Sub
Private Sub Command3_Click() '退出
Unload Me
Frm_main.Show
End Sub
Private Sub Command5_Click() '添加
Sleep 1000
'清空文本信息
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text4.SetFocus
frm_fwxx.Show '显示房屋信息窗体
'设置控件状态
CmdSave.Enabled = True
Command1.Enabled = True
Command5.Enabled = False
End Sub
Private Sub CmdDelete_Click() '删除
Adodc1.RecordSource = "select * from tab_fwinfo"
If Adodc1.Recordset.RecordCount > 0 Then '如果记录数大于零
myval = MsgBox("确定删除该信息吗?", vbYesNo, "系统提示")
'MsgBox 函数在对话框中显示消息,等待用户单击按钮,并返回一个 Integer 告诉用户单击哪一个按钮。
If myval = vbYes Then
Adodc1.Recordset.Delete '删除该记录
Adodc1.Recordset.Update
Adodc1.RecordSource = "select * from tab_fwinfo where 房间编号"
Adodc1.Refresh
' Text1.Text = DataGrid1.Columns(1).Text
'
' If DataGrid1.Columns(0).Text = Frm_rkinfocx.DataGrid3.Columns(0).Text Then
'' Adodc2.RecordSource = "select * from tab_yzinfo where 购入房编号" = Adodc1.RecordSource = "select * from tab_fwinfo where 房间编号" Then
' Adodc2.RecordSource = "select * from tab_yzinfo where 购入房编号"
' Adodc2.Recordset.Delete
' Adodc2.Recordset.Update
' Adodc2.RecordSource = "select * from tab_yzinfo where 购入房编号"
' Adodc2.Refresh
' End If
End If
Else
MsgBox "数据库中没有记录要删除", , "系统提示"
End If
Sleep 1000
Adodc1.RecordSource = "select * from tab_fwinfo"
Adodc1.Refresh
End Sub
Private Sub DataGrid1_Click()
Text11.Text = Adodc1.Recordset.Fields("房间编号")
End Sub
Private Sub Form_Load()
'Sleep 100
On Error Resume Next
'自动识别路径
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from tab_fwinfo where 房间编号"
Adodc1.Refresh
' Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
' Adodc2.RecordSource = "select * from tab_yzinfo where 购入房编号"
' Adodc2.Refresh
'
Set DataGrid1.DataSource = Adodc1
Set DataGrid2.DataSource = Adodc1
Text11.Text = Adodc1.Recordset.Fields("房间编号")
'设置控件状态
CmdSave.Enabled = False
Command1.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
MyStr = Text11.Text
End Sub
Private Sub SSTab1_DblClick()
Adodc1.Refresh
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text2获得焦点
Text2.SetFocus
End If
End Sub
Private Sub Text11_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键查询相应记录
Adodc1.RecordSource = "select * from tab_fwinfo where 房间编号 = '" + Text11.Text + "'"
Unload Me
frm_fwinfomd.Show
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text3获得焦点
Text3.SetFocus
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text6获得焦点
Text6.SetFocus
End If
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text5获得焦点
Text5.SetFocus
End If
End Sub
Private Sub Text5_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text6获得焦点
Text6.SetFocus
End If
End Sub
Private Sub Text6_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text7获得焦点
Text7.SetFocus
End If
End Sub
Private Sub Text7_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text8获得焦点
Text8.SetFocus
End If
End Sub
Private Sub Text8_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text9获得焦点
Text9.SetFocus
End If
End Sub
Private Sub Text9_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text10获得焦点
Text10.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -