📄 frmaddplace.frm
字号:
VERSION 5.00
Begin VB.Form frmAddPlace
BorderStyle = 1 'Fixed Single
Caption = "添加楼盘信息"
ClientHeight = 4890
ClientLeft = 45
ClientTop = 330
ClientWidth = 7800
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4890
ScaleWidth = 7800
Begin VB.TextBox txtFields
Height = 615
Index = 8
Left = 1560
TabIndex = 19
Top = 3120
Width = 6015
End
Begin VB.TextBox txtFields
Height = 375
Index = 7
Left = 5520
TabIndex = 17
Top = 2400
Width = 2055
End
Begin VB.TextBox txtFields
Height = 375
Index = 6
Left = 1560
TabIndex = 15
Top = 2430
Width = 2055
End
Begin VB.TextBox txtFields
Height = 375
Index = 5
Left = 5520
TabIndex = 13
Top = 1720
Width = 2055
End
Begin VB.TextBox txtFields
Height = 375
Index = 4
Left = 1560
TabIndex = 11
Top = 1740
Width = 2055
End
Begin VB.TextBox txtFields
Height = 375
Index = 3
Left = 5520
TabIndex = 9
Top = 1040
Width = 2055
End
Begin VB.TextBox txtFields
Height = 375
Index = 2
Left = 1560
TabIndex = 7
Top = 1050
Width = 2055
End
Begin VB.TextBox txtFields
Height = 375
Index = 1
Left = 5520
TabIndex = 5
Top = 360
Width = 2055
End
Begin VB.TextBox txtFields
Height = 375
Index = 0
Left = 1560
TabIndex = 3
Top = 360
Width = 2055
End
Begin VB.CommandButton cancelCommand
Caption = "关闭退出"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 4440
TabIndex = 1
Top = 4080
Width = 1215
End
Begin VB.CommandButton updateCommand
Caption = "保存记录"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 2160
TabIndex = 0
Top = 4080
Width = 1215
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "备注:"
Height = 180
Index = 8
Left = 360
TabIndex = 18
Top = 3120
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "开发日期:"
Height = 180
Index = 7
Left = 4320
TabIndex = 16
Top = 2520
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "楼房数量:"
Height = 180
Index = 6
Left = 360
TabIndex = 14
Top = 2460
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "绿化面积:"
Height = 180
Index = 5
Left = 4320
TabIndex = 12
Top = 1840
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "广场面积:"
Height = 180
Index = 4
Left = 360
TabIndex = 10
Top = 1800
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "占地面积:"
Height = 180
Index = 3
Left = 4320
TabIndex = 8
Top = 1160
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "建筑面积:"
Height = 180
Index = 2
Left = 360
TabIndex = 6
Top = 1140
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "地理位置:"
Height = 180
Index = 1
Left = 4320
TabIndex = 4
Top = 480
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "楼盘名称:"
Height = 180
Index = 0
Left = 360
TabIndex = 2
Top = 480
Width = 900
End
End
Attribute VB_Name = "frmAddPlace"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cancelCommand_Click()
Unload Me
End Sub
Private Sub txtfields_LostFocus(Index As Integer)
Dim pTitle As String
pTitle = "信息框"
If Not IsNumeric(txtfields(2).Text) And (txtfields(2).Text <> "") Then
MsgBox "请在“建筑面积”中输入数字", vbExclamation + vbOKOnly, pTitle
txtfields(2).SetFocus
txtfields(2).SelLength = Len(txtfields(2))
txtfields(2).SelStart = 0
End If
If Not IsNumeric(txtfields(3).Text) And (txtfields(3).Text <> "") Then
MsgBox "请在“占地面积”中输入数字", vbExclamation + vbOKOnly, pTitle
txtfields(3).SetFocus
txtfields(3).SelLength = Len(txtfields(3))
txtfields(3).SelStart = 0
End If
If Not IsNumeric(txtfields(4).Text) And (txtfields(4).Text <> "") Then
MsgBox "请在“广场面积”中输入数字", vbExclamation + vbOKOnly, pTitle
txtfields(4).SetFocus
txtfields(4).SelLength = Len(txtfields(4))
txtfields(4).SelStart = 0
End If
If Not IsNumeric(txtfields(5).Text) And (txtfields(5).Text <> "") Then
MsgBox "请在“绿化面积”中输入数字", vbExclamation + vbOKOnly, pTitle
txtfields(5).SetFocus
txtfields(5).SelLength = Len(txtfields(5))
txtfields(5).SelStart = 0
End If
If Not IsNumeric(txtfields(6).Text) And (txtfields(6).Text <> "") Then
MsgBox "请在“楼房数量”中输入数字", vbExclamation + vbOKOnly, pTitle
txtfields(6).SetFocus
txtfields(6).SelLength = Len(txtfields(6))
txtfields(6).SelStart = 0
End If
If Not IsDate(txtfields(7).Text) And (txtfields(7).Text <> "") Then
MsgBox "请在“开发日期”中输入日期yyyy-mm-dd", vbExclamation + vbOKOnly, pTitle
txtfields(7).SetFocus
txtfields(7).SelLength = Len(txtfields(6))
txtfields(7).SelStart = 0
End If
End Sub
Private Sub updateCommand_Click()
Dim txtSQL As String
Dim MsgText As String
Dim mrcc As ADODB.Recordset
If Not Testtxt(txtfields(0).Text) Then
MsgBox "请输入楼盘名称!", vbOKOnly + vbExclamation, "警告"
txtfields(0).SetFocus
Exit Sub
End If
txtSQL = "select * from 楼盘信息 where 楼盘名称 = '" & Trim(txtfields(0).Text) & "'"
Set mrcc = ExecuteSQL(txtSQL, MsgText)
If mrcc.EOF = False Then
MsgBox "楼盘名称重复,请重新输入!", vbOKOnly + vbExclamation, "警告"
mrcc.Close
txtfields(0).SetFocus
Else
mrcc.AddNew
mrcc.Fields(0) = Trim(txtfields(0).Text)
mrcc.Fields(1) = Val(txtfields(1).Text)
mrcc.Fields(2) = Val(txtfields(2).Text)
mrcc.Fields(3) = Val(txtfields(3).Text)
mrcc.Fields(4) = Val(txtfields(4).Text)
mrcc.Fields(5) = Val(txtfields(5).Text)
mrcc.Fields(6) = Val(txtfields(6).Text)
mrcc.Fields(7) = CDate(txtfields(7).Text)
mrcc.Fields(8) = Trim(txtfields(8).Text)
mrcc.Update
MsgBox "楼盘信息添加成功!", vbOKOnly + vbExclamation, "添加楼盘信息"
mrcc.Close
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -