📄 frm_dlinfo.frm
字号:
Height = 375
Left = 2220
TabIndex = 31
Top = 225
Width = 1000
End
End
Begin MSDataGridLib.DataGrid DataGrid2
Height = 2940
Left = -74790
TabIndex = 38
Top = 600
Width = 8595
_ExtentX = 15161
_ExtentY = 5186
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Label Label21
AutoSize = -1 'True
Caption = "单击要删除的记录然后按删除按钮:"
Height = 180
Left = -74025
TabIndex = 41
Top = 4545
Width = 2880
End
Begin VB.Label Label20
AutoSize = -1 'True
Caption = "大楼编号:"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = -70185
TabIndex = 40
Top = 3915
Width = 975
End
Begin VB.Label Label19
AutoSize = -1 'True
Caption = "输入要更新记录的编号然后按回车:"
Height = 180
Left = -74025
TabIndex = 39
Top = 3915
Width = 2880
End
End
Begin VB.Label Label16
Caption = "Label16"
Height = 210
Left = 3465
TabIndex = 47
Top = 6240
Width = 1575
End
Begin VB.Label Label18
Caption = "Label18"
DataField = "小区名称"
DataSource = "Adodc3"
Height = 300
Left = 2175
TabIndex = 42
Top = 6120
Width = 1035
End
End
Attribute VB_Name = "Frm_dlinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim myval As String
Dim a As String
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click() '删除
Adodc1.RecordSource = "select * from tab_dlinfo "
If Adodc1.Recordset.RecordCount > 0 Then '如果记录数大于零
a = MsgBox("您确定要删除这条数据吗?", vbYesNo, "系统提示")
If a = vbYes Then
If Adodc3.Recordset.RecordCount > 0 Then
' Adodc3.RecordSource = "select * from tab_fwinfo where 大楼名称"
Adodc3.Recordset.Delete
Adodc3.Recordset.Update
Adodc3.RecordSource = "select * from tab_fwinfo where 大楼名称"
Adodc3.Refresh
End If
If Adodc4.Recordset.RecordCount > 0 Then
' Adodc4.RecordSource = "select * from tab_yzinfo where 大楼名称"
Adodc4.Recordset.Delete
Adodc4.Recordset.Update
Adodc4.RecordSource = "select * from tab_yzinfo where 大楼名称"
Adodc4.Refresh
End If
Adodc1.Recordset.Delete '删除该记录
Adodc1.Recordset.Update '修改数据记录
Adodc1.RecordSource = "select * from tab_dlinfo"
Adodc1.Refresh
End If
Else
MsgBox "没有要删除的数据!", , "系统提示"
End If
Sleep 1000
Adodc1.RecordSource = "select * from tab_dlinfo"
Adodc1.Refresh
Set DataGrid2.DataSource = Adodc1
Set DataGrid1.DataSource = Adodc1
End Sub
Private Sub CmdSave_Click() '保存
Sleep 1000
If Combo1.Text = "" Or Text13 = "" Or Text6 = "" Or Text7 = "" Or Text8 = "" Or Text9 = "" Or Text5 = "" Or Text10 = "" Or Text11 = "" 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
myval = MsgBox("确定保存吗?", vbYesNo, "系统提示")
'MsgBox 函数在对话框中显示消息,等待用户单击按钮,并返回一个 Integer 告诉用户单击哪一个按钮。
If myval = vbYes Then
Sleep 100
Frm_dl.Adodc1.Recordset.Delete
Frm_dl.Adodc1.Refresh
Unload Frm_dl
Set adors = cn.Execute("insert into tab_dlinfo values('" & Text1 & "','" & Text2 & "','" & Text4 & "','" & Text10 & "','" & Text7 & "','" & Text9 & "','" & Text3 & "','" & Text13 & "','" & Text11 & "','" & Text6 & "','" & DTPicker1 & "','" & DTPicker2 & "','" & Text5 & "','" & Combo1 & "','" & Text8 & "') ")
MsgBox "数据保存成功", , "系统提示"
Adodc1.Refresh
End If
End Sub
Private Sub Command2_Click() '退出
Unload Me
Frm_main.Show
End Sub
Private Sub CmdAdd_Click() '添加
'清空文本框
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Frm_dl.Show '显示大楼信息窗体
End Sub
Private Sub Command9_Click() '退出
Unload Me
Frm_main.Show
End Sub
Private Sub Form_Load()
Dim i As Integer
DTPicker1.Value = Date
DTPicker2.Value = Date
'自动识别路径
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from tab_dlinfo where 大楼编号 like '%" + Frm_xqinfodj.Text1.Text + "%'"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
Set DataGrid2.DataSource = Adodc1
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
Adodc2.RecordSource = "select * from tab_frontage "
Adodc2.Refresh
Adodc3.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
Adodc3.RecordSource = "select * from tab_fwinfo "
Adodc3.Refresh
Adodc4.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
Adodc4.RecordSource = "select * from tab_yzinfo "
Adodc4.Refresh
' If Adodc2.Recordset.RecordCount > 0 Then
' Adodc2.Recordset.MoveFirst
' Do While Adodc2.Recordset.EOF = False
' Combo1.AddItem Adodc2.Recordset.Fields("房屋朝向")
' Combo1.ListIndex = 0
' Adodc2.Recordset.MoveNext
' Loop
' End If
Image1.Picture = LoadPicture(App.Path & "\image\大楼2.jpg")
Dim rs As New ADODB.Recordset
rs.Open "select * from tab_frontage", cn, 1, 3
If rs.RecordCount > 0 Then
rs.MoveFirst
For i = 0 To rs.RecordCount - 1
Combo1.AddItem rs.Fields("房屋朝向")
rs.MoveNext
Next i
End If
rs.Close
End Sub
Private Sub Text11_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text6获得焦点
Text6.SetFocus
End If
End Sub
Private Sub Text12_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键根据大楼编号检索相关信息
frm_dlinfomd.Adodc1.RecordSource = "select * from tab_dlinfo where 大楼编号 = '" + Trim(Text12.Text) + "'"
Unload Me
frm_dlinfomd.Adodc1.Refresh
frm_dlinfomd.DTPicker1.Value = Adodc1.Recordset.Fields("竣工日期")
frm_dlinfomd.DTPicker2.Value = Adodc1.Recordset.Fields("交工日期")
frm_dlinfomd.Show
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 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 '按回车键Text11获得焦点
Text11.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -