📄 frmcardsedit.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form FrmCardsEdit
BorderStyle = 1 'Fixed Single
Caption = "编辑借阅证信息"
ClientHeight = 3900
ClientLeft = 45
ClientTop = 330
ClientWidth = 8205
Icon = "FrmCardsEdit.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3900
ScaleWidth = 8205
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Cmd_UnLost
Caption = "取消挂失"
Default = -1 'True
Height = 400
Left = 6720
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 15
Top = 2205
Width = 1300
End
Begin VB.CommandButton Cmd_Lost
Caption = "挂 失"
Height = 400
Left = 6720
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 14
Top = 1395
Width = 1300
End
Begin VB.CommandButton Cmd_OK
Caption = "确 定"
Height = 400
Left = 6720
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 3
Top = 600
Width = 1300
End
Begin VB.CommandButton Cmd_Cancel
Cancel = -1 'True
Caption = "取 消"
Height = 400
Left = 6720
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 4
Top = 3000
Width = 1300
End
Begin VB.Frame Frame1
Height = 3615
Left = 120
TabIndex = 5
Top = 120
Width = 6375
Begin MSDataListLib.DataCombo dco_CardType
Bindings = "FrmCardsEdit.frx":0442
Height = 330
Left = 1680
TabIndex = 18
Top = 1680
Width = 1815
_ExtentX = 3201
_ExtentY = 582
_Version = 393216
ListField = "TypeName"
BoundColumn = "Id"
Text = ""
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 3960
Top = 2640
Visible = 0 'False
Width = 2055
_ExtentX = 3625
_ExtentY = 661
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.TextBox txtCardNo
BeginProperty Font
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 1680
MaxLength = 100
TabIndex = 16
Top = 300
Width = 4575
End
Begin VB.TextBox txtCreateDate
BeginProperty DataFormat
Type = 1
Format = "yyyy-MM-dd"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 3
EndProperty
BeginProperty Font
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 1680
MaxLength = 20
TabIndex = 6
Top = 2640
Width = 1815
End
Begin VB.TextBox txtName
BeginProperty Font
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 1680
MaxLength = 50
TabIndex = 1
Top = 1200
Width = 4575
End
Begin VB.TextBox txtIdCard
BeginProperty Font
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 1680
MaxLength = 20
TabIndex = 2
Top = 2160
Width = 4575
End
Begin VB.TextBox txtWorkPlace
BeginProperty Font
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 1680
MaxLength = 100
TabIndex = 0
Top = 720
Width = 4575
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "证件类型"
Height = 180
Left = 360
TabIndex = 17
Top = 1785
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "借阅证编号"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 360
TabIndex = 13
Top = 360
Width = 900
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "有效证件号码"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 360
TabIndex = 12
Top = 2280
Width = 1080
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "姓 名"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 360
TabIndex = 11
Top = 1320
Width = 540
End
Begin VB.Label Label8
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "工作单位"
Height = 180
Left = 360
TabIndex = 10
Top = 840
Width = 720
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "发证日期"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 360
TabIndex = 9
Top = 2760
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "状 态"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 360
TabIndex = 8
Top = 3240
Width = 720
End
Begin VB.Label lbl_Status
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "有效"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 1680
TabIndex = 7
Top = 3240
Width = 720
End
End
End
Attribute VB_Name = "FrmCardsEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean '插入=false,修改=true
Public OriCardNo As String
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
'检查用户录入数据的有效性
If Len(Trim(txtCardNo)) = 0 Then
MsgBox "请输入借阅证号!"
txtCardNo.SetFocus
txtCardNo.SelStart = 0
txtCardNo.SelLength = Len(txtCardNo)
Exit Sub
End If
If Len(Trim(txtName)) = 0 Then
MsgBox "请输入姓名"
txtName.SetFocus
txtName.SelStart = 0
txtName.SelLength = Len(txtName)
Exit Sub
End If
If Len(Trim(txtIdCard)) = 0 Then
MsgBox "请输入有效证件号码"
txtIdCard.SetFocus
txtIdCard.SelStart = 0
txtIdCard.SelLength = Len(txtIdCard)
Exit Sub
End If
If Len(Trim(dco_CardType.Text)) = 0 Then
MsgBox "请选择证件类型"
dco_CardType.SetFocus
Exit Sub
End If
If Len(Trim(txtCreateDate)) = 0 Then
MsgBox "请输入发证日期"
txtCreateDate.SetFocus
txtCreateDate.SelStart = 0
txtCreateDate.SelLength = Len(txtCreateDate)
Exit Sub
End If
'把用户录入的数据赋值到数据库对象变量中
With MyCards
.Cardno = MakeStr(txtCardNo)
.WorkPlace = MakeStr(txtWorkPlace)
.Name = MakeStr(txtName)
.TypeId = Val(dco_CardType.BoundText)
.Idcard = MakeStr(txtIdCard)
.CreateDate = MakeStr(txtCreateDate)
.Status = MakeStr(lbl_Status)
'根据变量Modify的值,决定是插入新数据,还是修改已有的数据
If Modify = False Then
'判断此借阅证号是否存在
If .In_DB(MakeStr(txtCardNo)) = True Then
MsgBox ("已经存在此借阅证号")
txtCardNo.SetFocus
Exit Sub
End If
.Insert
Else
Call .Update(OriCardNo)
End If
End With
'关闭窗口
Unload Me
End Sub
Private Sub Cmd_Lost_Click()
'设置Status为挂失
Call MyCards.UpdateStatus(OriCardNo, "挂失")
Unload Me
End Sub
Private Sub Cmd_UnLost_Click()
lbl_Status.Caption = "有效"
Call MyCards.UpdateStatus(OriCardNo, "有效")
Unload Me
End Sub
Private Sub Form_Load()
'设置ADO控件的连接字符串
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
+ App.Path + "\Books.mdb;Persist Security Info=False"
'设置数据源
Adodc1.RecordSource = "SELECT * FROM CardType"
Adodc1.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -