📄 frmroomsource.frm
字号:
Height = 255
Left = 120
TabIndex = 33
Top = 2055
Width = 615
End
Begin VB.Label Label5
Caption = "使用面积"
Height = 255
Left = 120
TabIndex = 32
Top = 1695
Width = 735
End
Begin VB.Label Label4
Caption = "建筑面积"
Height = 255
Left = 120
TabIndex = 31
Top = 1335
Width = 735
End
Begin VB.Label Label3
Caption = "房间号"
Height = 255
Left = 120
TabIndex = 30
Top = 975
Width = 615
End
Begin VB.Label Label2
Caption = "楼层"
Height = 255
Left = 120
TabIndex = 29
Top = 615
Width = 615
End
Begin VB.Label Label1
Caption = "代码"
Height = 255
Left = 120
TabIndex = 28
Top = 255
Width = 615
End
Begin VB.Label Label12
Caption = "元"
Height = 255
Left = 2040
TabIndex = 27
Top = 2040
Width = 255
End
Begin VB.Label Label15
Caption = "元/平方米"
Height = 255
Left = 2040
TabIndex = 26
Top = 2400
Width = 855
End
End
End
End
Begin VB.CommandButton Command5
Caption = "关闭"
Height = 375
Left = 8160
TabIndex = 5
Top = 4080
Width = 975
End
Begin VB.CommandButton Command4
Caption = "删除"
Height = 375
Left = 8160
TabIndex = 4
Top = 3120
Width = 975
End
Begin VB.CommandButton Command1
Caption = "增加"
Height = 375
Left = 8160
TabIndex = 2
Top = 720
Width = 975
End
Begin VB.CommandButton Command2
Caption = "修改"
Height = 375
Left = 8160
TabIndex = 1
Top = 1440
Width = 975
End
Begin VB.CommandButton Command3
Caption = "查找"
Height = 375
Left = 8160
TabIndex = 0
Top = 2280
Width = 975
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 4815
Left = 120
TabIndex = 3
Top = 120
Width = 7215
_ExtentX = 12726
_ExtentY = 8493
_Version = 393216
AllowUpdate = 0 'False
AllowArrows = -1 'True
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
Locked = -1 'True
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
Attribute VB_Name = "frmroomsource"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim WithEvents adoPrimaryRS As Recordset
Attribute adoPrimaryRS.VB_VarHelpID = -1
Dim WithEvents rs As Recordset
Attribute rs.VB_VarHelpID = -1
Dim mvBookMark As Variant
Dim mbEditFlag As Boolean
Dim mbAddNewFlag As Boolean
Private Sub Command3_Click()
Frame2.Visible = True
Combo3.Visible = True
Combo2.Visible = True
Frame1.Visible = False
End Sub
Private Sub Command8_Click()
Frame1.Visible = False
Frame2.Visible = False
End Sub
Private Sub Check1_Click()
If Check1.Value = 1 Then
Check2.Value = 0
Combo2.Clear
SQL = "select distinct 楼宇 from 房产资源"
Set rs = db.Execute(SQL)
Do While Not rs.EOF
If IsNull(rs("楼宇")) = False Then
Combo2.AddItem rs("楼宇")
End If
rs.MoveNext
Loop
End If
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
Check1.Value = 0
Combo3.Clear
SQL = "select distinct 代码 from 房产资源"
Set rs = db.Execute(SQL)
Do While Not rs.EOF
If IsNull(rs("代码")) = False Then
Combo3.AddItem rs("代码")
End If
rs.MoveNext
Loop
End If
End Sub
Private Sub Command9_Click()
If Check1.Value = 1 And Combo2.Text <> "" Then
DataGrid_sql = "select * from 房产资源 where 楼宇= '" & Combo2.Text & "'"
End If
If Check2.Value = 1 And Combo3.Text <> "" Then
DataGrid_sql = "select * from 房产资源 where 代码= '" & Combo3.Text & "'"
End If
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open DataGrid_sql, db, adOpenStatic, adLockOptimistic
adoPrimaryRS.Requery
Set DataGrid6.DataSource = adoPrimaryRS
End Sub
Private Sub DataGrid6_DblClick()
Frame1.Visible = True
Frame2.Visible = False
End Sub
Private Sub Form_Load()
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "select * from 房产资源 ", db, adOpenStatic, adLockOptimistic
Set DataGrid1.DataSource = adoPrimaryRS
Set Combo1.DataSource = adoPrimaryRS
Set Text1.DataSource = adoPrimaryRS
Set Text2.DataSource = adoPrimaryRS
Set Text3.DataSource = adoPrimaryRS
Set Text4.DataSource = adoPrimaryRS
Set Text6.DataSource = adoPrimaryRS
Set Text7.DataSource = adoPrimaryRS
Set Text5.DataSource = adoPrimaryRS
Set Text8.DataSource = adoPrimaryRS
Set Text9.DataSource = adoPrimaryRS
Set Text10.DataSource = adoPrimaryRS
Set Text11.DataSource = adoPrimaryRS
Set Text13.DataSource = adoPrimaryRS
Set Text14.DataSource = adoPrimaryRS
Set Text15.DataSource = adoPrimaryRS
Set Text16.DataSource = adoPrimaryRS
Text16.Text = "无"
Frame1.Visible = False
Frame2.Visible = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
frmmain.Enabled = True
Unload Me
End Sub
Private Sub Command2_Click() '修改
Frame1.Visible = True
Frame2.Visible = False
mbAddNewFlag = False
End Sub
Private Sub Command1_Click() '增加
Text16.Text = "无"
With adoPrimaryRS
If Not (.BOF And .EOF) Then
mvBookMark = .Bookmark
End If
.AddNew
mbAddNewFlag = True
End With
Frame1.Visible = True
Frame2.Visible = False
Combo1.Text = ""
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text6.Text = ""
Text7.Text = ""
Text5.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Text15.Text = ""
Text16.Text = "无"
End Sub
Private Sub Command4_Click() '删除
On Error GoTo DeleteErr
Dim Resp As Integer
Resp = MsgBox("你真的要删除该记录吗?", vbExclamation + vbOKCancel, pTitle)
If Resp = 2 Then
Exit Sub
Else
With adoPrimaryRS
.Delete
.MoveNext
If .EOF Then .MoveLast
End With
End If
Exit Sub
DeleteErr:
MsgBox "删除操作有错误", vbExclamation + vbOKOnly, pTitle
End Sub
Private Sub Command7_Click() '取消
' On Error Resume Next
On Error GoTo CancelErr
If mbAddNewFlag = True Then
adoPrimaryRS.Delete
mbAddNewFlag = False
Else
mbEditFlag = False
adoPrimaryRS.CancelUpdate
End If
If mvBookMark > 0 Then
adoPrimaryRS.Bookmark = mvBookMark
Else
adoPrimaryRS.MoveFirst
End If
Frame1.Visible = False
Exit Sub
CancelErr:
MsgBox "取消操作有错误", vbExclamation + vbOKOnly, pTitle
Frame1.Visible = False
Frame2.Visible = False
mbAddNewFlag = False
End Sub
Private Sub Command6_Click()
On Error GoTo UpdateErr
adoPrimaryRS.UpdateBatch adAffectAll
If mbAddNewFlag Then
adoPrimaryRS.MoveLast 'move to the new record
End If
mbEditFlag = False
mbAddNewFlag = False
Frame1.Visible = False
Exit Sub
UpdateErr:
MsgBox "保存操作错误", vbExclamation + vbOKOnly, pTitle
Frame1.Visible = False
Frame2.Visible = True
End Sub
Private Sub Command5_Click()
frmmain.Enabled = True
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -