📄 frmaddinfo.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmaddinfo
BorderStyle = 1 'Fixed Single
Caption = "合同添加"
ClientHeight = 3825
ClientLeft = 45
ClientTop = 435
ClientWidth = 8025
Icon = "frmaddinfo.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3825
ScaleWidth = 8025
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 450
Left = 2400
Top = 3960
Width = 1215
_ExtentX = 2143
_ExtentY = 794
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
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
Begin VB.Frame Frame1
Height = 3615
Left = 120
TabIndex = 0
Top = 120
Width = 7815
Begin VB.CommandButton Command2
Caption = "取消返回"
Height = 375
Left = 4800
TabIndex = 18
Top = 2880
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "添加合同"
Height = 375
Left = 1560
TabIndex = 17
Top = 2880
Width = 1455
End
Begin VB.ComboBox Combo2
Height = 300
Left = 5280
TabIndex = 15
Text = "请选择地区"
Top = 2160
Width = 1935
End
Begin VB.TextBox TxtAdd
Height = 375
Left = 1320
TabIndex = 13
Top = 2160
Width = 2295
End
Begin VB.TextBox TxtTel
Height = 375
Left = 5280
TabIndex = 11
Top = 1560
Width = 1935
End
Begin VB.TextBox TxtCTel
Height = 375
Left = 1320
TabIndex = 9
Top = 1560
Width = 2295
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 375
Left = 5280
TabIndex = 7
Top = 960
Width = 1935
_ExtentX = 3413
_ExtentY = 661
_Version = 393216
Format = 23658497
CurrentDate = 38734
End
Begin VB.TextBox Text2
Height = 375
Left = 1320
TabIndex = 5
Top = 960
Width = 2295
End
Begin VB.ComboBox Combo1
Height = 300
Left = 5280
TabIndex = 2
Text = "请选择星级"
Top = 360
Width = 1935
End
Begin VB.TextBox Text1
Height = 375
Left = 1320
TabIndex = 1
Top = 360
Width = 2295
End
Begin VB.Label Label8
Caption = "所在地点:"
Height = 255
Left = 4320
TabIndex = 16
Top = 2280
Width = 975
End
Begin VB.Label Label7
Caption = "酒店地址:"
Height = 255
Left = 360
TabIndex = 14
Top = 2280
Width = 975
End
Begin VB.Label Label6
Caption = "前台总机:"
Height = 255
Left = 4320
TabIndex = 12
Top = 1680
Width = 975
End
Begin VB.Label Label5
Caption = "销售电话:"
Height = 255
Left = 360
TabIndex = 10
Top = 1680
Width = 975
End
Begin VB.Label Label4
Caption = "到期日期:"
Height = 255
Left = 4320
TabIndex = 8
Top = 1080
Width = 1095
End
Begin VB.Label Label3
Caption = "合同编号:"
Height = 255
Left = 360
TabIndex = 6
Top = 1080
Width = 1095
End
Begin VB.Label Label2
Caption = "酒店星级:"
Height = 255
Left = 4320
TabIndex = 4
Top = 480
Width = 975
End
Begin VB.Label Label1
Caption = "酒店名称:"
Height = 375
Left = 360
TabIndex = 3
Top = 480
Width = 975
End
End
End
Attribute VB_Name = "frmaddinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim sql As String
Dim conn As New ADODB.Connection
Dim rs_readerstyle As New ADODB.Recordset
If Trim(Text1.Text) = "" Then
MsgBox "酒店名称不能为空 ", vbOK0nly + vbExclamation, ""
Text1.SetFocus
Exit Sub
End If
If Trim(Text2.Text) = "" Then
MsgBox "合同编号不能为空", vbOK0nly + vbExclamation, ""
Text2.SetFocus
Exit Sub
End If
If Trim(TxtCTel.Text) = "" Then
MsgBox "销售部电话不能为空", vbOK0nly + vbExclamation, ""
TxtCTel.SetFocus
Exit Sub
End If
If Trim(TxtAdd.Text) = "" Then
MsgBox "酒店地址不能为空", vbOK0nly + vbExclamation, ""
TxtAdd.SetFocus
Exit Sub
End If
If Trim(TxtTel.Text) = "" Then
MsgBox "酒店总机不能为空", vbOKOnly + vbExclamation, ""
TxtTel.SetFocus
Exit Sub
End If
conn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\database\yh8888.mdb"
sql = "select * from 酒店合同 where 酒店名称='" & Text1.Text & "'"
rs_readerstyle.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_readerstyle.EOF Then
rs_readerstyle.AddNew
rs_readerstyle.Fields(0) = Trim(Text1.Text)
rs_readerstyle.Fields(1) = Trim(Combo1.Text)
rs_readerstyle.Fields(2) = Trim(Text2.Text)
rs_readerstyle.Fields(3) = Trim(DTPicker1.Value)
rs_readerstyle.Fields(4) = Trim(TxtCTel.Text)
rs_readerstyle.Fields(5) = Trim(TxtTel.Text)
rs_readerstyle.Fields(6) = Trim(TxtAdd.Text)
rs_readerstyle.Fields(7) = Trim(Combo2.Text)
rs_readerstyle.Update
MsgBox "添加酒店合同成功!", vbOKOnly, ""
rs_readerstyle.Close
Else
MsgBox "酒店合同重复!", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Text1.Text = ""
rs_readerstyle.Close
Exit Sub
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim dbName As String
Dim connSTR As String
On Error GoTo errEnd
dbName = App.Path
If Right(dbName, 1) <> "\" Then dbName = dbName + "\"
dbName = dbName + "DataBase\yh8888.mdb"
connSTR = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbName & ";Persist Security Info=False"
Adodc1.ConnectionString = connSTR
Combo1.AddItem "五星级"
Combo1.AddItem "准五星级"
Combo1.AddItem "四星级"
Combo1.AddItem "准四星级"
Combo1.AddItem "三星级"
Combo1.AddItem "准三星级"
Combo1.AddItem "二星级"
Combo1.AddItem "准二星级"
Combo2.AddItem "白云区"
Combo2.AddItem "越秀区"
Combo2.AddItem "东山区"
Combo2.AddItem "海珠区"
Combo2.AddItem "荔湾区"
Combo2.AddItem "花都区"
Combo2.AddItem "天河区"
Exit Sub
errEnd:
MsgBox Err.Description, vbOKOnly + vbExclamation, "打开数据库出错"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -