📄 frmvisitor.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "tabctl32.ocx"
Begin VB.Form frmvisitor
Caption = "外来访客登记"
ClientHeight = 7170
ClientLeft = 60
ClientTop = 450
ClientWidth = 9075
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 7170
ScaleWidth = 9075
Begin TabDlg.SSTab SSTab1
Height = 5535
Left = 480
TabIndex = 0
Top = 480
Width = 7935
_ExtentX = 13996
_ExtentY = 9763
_Version = 393216
Tabs = 2
Tab = 1
TabsPerRow = 2
TabHeight = 520
TabCaption(0) = "外来访客信息浏览"
TabPicture(0) = "frmvisitor.frx":0000
Tab(0).ControlEnabled= 0 'False
Tab(0).Control(0)= "DataGrid1"
Tab(0).Control(1)= "Adodc1"
Tab(0).ControlCount= 2
TabCaption(1) = "外来访客信息添加 "
TabPicture(1) = "frmvisitor.frx":001C
Tab(1).ControlEnabled= -1 'True
Tab(1).Control(0)= "Label5"
Tab(1).Control(0).Enabled= 0 'False
Tab(1).Control(1)= "Label4"
Tab(1).Control(1).Enabled= 0 'False
Tab(1).Control(2)= "Label3"
Tab(1).Control(2).Enabled= 0 'False
Tab(1).Control(3)= "Label2"
Tab(1).Control(3).Enabled= 0 'False
Tab(1).Control(4)= "Label1"
Tab(1).Control(4).Enabled= 0 'False
Tab(1).Control(5)= "Adodc2"
Tab(1).Control(5).Enabled= 0 'False
Tab(1).Control(6)= "Text5"
Tab(1).Control(6).Enabled= 0 'False
Tab(1).Control(7)= "Text4"
Tab(1).Control(7).Enabled= 0 'False
Tab(1).Control(8)= "Text3"
Tab(1).Control(8).Enabled= 0 'False
Tab(1).Control(9)= "Text2"
Tab(1).Control(9).Enabled= 0 'False
Tab(1).Control(10)= "Text1"
Tab(1).Control(10).Enabled= 0 'False
Tab(1).Control(11)= "Frame1"
Tab(1).Control(11).Enabled= 0 'False
Tab(1).ControlCount= 12
Begin VB.Frame Frame1
Caption = "编辑"
Height = 1095
Left = 600
TabIndex = 6
Top = 3120
Width = 6375
Begin VB.CommandButton Command3
Caption = "退出"
Height = 495
Left = 4560
TabIndex = 9
Top = 360
Width = 1575
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 2400
TabIndex = 8
Top = 360
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "添加并保存"
Height = 495
Left = 360
TabIndex = 7
Top = 360
Width = 1695
End
End
Begin VB.TextBox Text1
Height = 495
Left = 1560
TabIndex = 5
Top = 720
Width = 1575
End
Begin VB.TextBox Text2
Height = 495
Left = 5040
TabIndex = 4
Top = 720
Width = 1815
End
Begin VB.TextBox Text3
Height = 495
Left = 1560
MultiLine = -1 'True
TabIndex = 3
Top = 1440
Width = 1575
End
Begin VB.TextBox Text4
Height = 1095
Left = 5040
MultiLine = -1 'True
TabIndex = 2
Top = 1560
Width = 1935
End
Begin VB.TextBox Text5
Height = 615
Left = 1560
TabIndex = 1
Top = 2040
Width = 3375
End
Begin MSAdodcLib.Adodc Adodc2
Height = 375
Left = 5280
Top = 4680
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = $"frmvisitor.frx":0038
OLEDBString = $"frmvisitor.frx":00C5
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "外来会客登记"
Caption = "Adodc2"
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 MSDataGridLib.DataGrid DataGrid1
Height = 2895
Left = -74880
TabIndex = 10
Top = 960
Width = 7575
_ExtentX = 13361
_ExtentY = 5106
_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 = 4
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
BeginProperty Column02
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 Column03
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
ColumnWidth = 1635.024
EndProperty
BeginProperty Column02
ColumnWidth = 1649.764
EndProperty
BeginProperty Column03
ColumnWidth = 1874.835
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 615
Left = -69240
Top = 4320
Visible = 0 'False
Width = 1455
_ExtentX = 2566
_ExtentY = 1085
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:\公寓管理信息系统\数据.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\公寓管理信息系统\数据.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from 晚归学生登记"
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.Label Label1
Caption = "来访时间:"
Height = 375
Left = 240
TabIndex = 15
Top = 840
Width = 1095
End
Begin VB.Label Label2
Caption = "学生姓名:"
Height = 495
Left = 3840
TabIndex = 14
Top = 840
Width = 1335
End
Begin VB.Label Label3
Caption = "与学生关系: "
Height = 495
Left = 240
TabIndex = 13
Top = 1560
Width = 1215
End
Begin VB.Label Label4
Caption = "来访原因:"
Height = 495
Left = 3840
TabIndex = 12
Top = 1440
Width = 1215
End
Begin VB.Label Label5
Caption = "备注:"
Height = 495
Left = 240
TabIndex = 11
Top = 2160
Width = 1095
End
End
End
Attribute VB_Name = "frmvisitor"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim con As ADODB.Connection
Private Sub Command1_Click()
Dim myrs As New ADODB.Recordset
myrs.Open "SELECT * FROM 外来会客登记", con, adOpenDynamic, adLockOptimistic, adCmdText
myrs.AddNew
If Text1.Text = Empty Then
MsgBox "来访时间不能为空!"
Text1.SetFocus
Exit Sub
End If
If Text2.Text = Empty Then
MsgBox "学生姓名不能为空!"
Text2.SetFocus
Exit Sub
End If
If Text3.Text = Empty Then
MsgBox "请输入与学生关系!"
Text3.SetFocus
Exit Sub
End If
If Text4.Text = Empty Then
MsgBox "请输入来访原因!"
Text4.SetFocus
Exit Sub
End If
myrs.Fields(0) = Text1.Text
myrs.Fields(1) = Text2.Text
myrs.Fields(2) = Text3.Text
myrs.Fields(3) = Text4.Text
myrs.Fields(4) = Text5.Text
myrs.Update
MsgBox "添加外来访客信息成功!"
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
'创建连接,并打开
Dim myrs As New ADODB.Recordset
Set con = New ADODB.Connection
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\数据.mdb.;Persist Security Info=False"
con.CursorLocation = adUseClient
con.Open
query = "SELECT * FROM 外来会客登记"
myrs.Open query, con, adOpenForwardOnly, adLockReadOnly
Set DataGrid1.DataSource = myrs
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -