📄 frmaddcardinfo.frm
字号:
VERSION 5.00
Begin VB.Form frmAddcardinfo
BorderStyle = 1 'Fixed Single
Caption = "新卡入库"
ClientHeight = 4230
ClientLeft = 45
ClientTop = 435
ClientWidth = 5085
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4230
ScaleWidth = 5085
Begin VB.TextBox txtCardvalue
Height = 375
Left = 1440
TabIndex = 9
Top = 2040
Width = 2415
End
Begin VB.TextBox txtCardstatue
Height = 375
Left = 1440
TabIndex = 7
Top = 1320
Width = 2415
End
Begin VB.CommandButton Command1
BackColor = &H00FFC0C0&
Caption = "确认添加(&O)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 600
TabIndex = 5
Top = 3600
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "取消添加(&X)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 3240
TabIndex = 4
Top = 3600
Width = 1215
End
Begin VB.ComboBox comboSchoolno
Height = 315
Left = 1440
TabIndex = 3
Top = 2640
Width = 2535
End
Begin VB.TextBox txtCardno
Height = 375
Left = 1440
TabIndex = 2
Top = 720
Width = 2415
End
Begin VB.Frame Frame1
Caption = "新卡信息"
Height = 3135
Left = 480
TabIndex = 10
Top = 240
Width = 4095
Begin VB.Label Label8
Caption = "校区号"
Height = 375
Left = 360
TabIndex = 14
Top = 2400
Width = 615
End
Begin VB.Label Label7
Caption = "卡值"
Height = 375
Left = 360
TabIndex = 13
Top = 1920
Width = 615
End
Begin VB.Label Label6
Caption = "卡状态"
Height = 495
Left = 240
TabIndex = 12
Top = 1200
Width = 615
End
Begin VB.Label Label5
Caption = "卡号"
Height = 375
Left = 360
TabIndex = 11
Top = 600
Width = 495
End
End
Begin VB.Label Label4
Caption = "卡值"
Height = 375
Left = 1800
TabIndex = 8
Top = 1560
Width = 495
End
Begin VB.Label Label3
Caption = "卡态"
Height = 375
Left = 1800
TabIndex = 6
Top = 960
Width = 375
End
Begin VB.Label Label2
Caption = "校区"
Height = 375
Left = 1800
TabIndex = 1
Top = 2160
Width = 855
End
Begin VB.Label Label1
Caption = "卡号"
Height = 375
Left = 1800
TabIndex = 0
Top = 360
Width = 735
End
End
Attribute VB_Name = "frmAddcardinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim mrc As ADODB.Recordset
Dim MsgText As String
Dim txtSQL As String
If Not Testtxt(txtCardno.Text) Then
MsgBox "请输入卡号!", vbOKOnly + vbExclamation, "提示您"
txtCardno.SetFocus
Exit Sub
End If
If Not Testtxt(comboSchoolno.Text) Then
MsgBox "请选择年级!", vbOKOnly + vbExclamation, "提示您"
comboSchoolno.SetFocus
Exit Sub
End If
If Not IsNumeric(Trim(txtCardno.Text)) Then
MsgBox "请输入数字!", vbOKOnly + vbExclamation, "提示您"
Exit Sub
txtCardno.SetFocus
End If
txtSQL = "select * from card_Info "
Set mrc = ExecuteSQL(txtSQL, MsgText)
While (mrc.EOF = False)
If (Trim(mrc.Fields(0)) = Trim(txtCardno.Text)) Then
MsgBox "卡号已经存在,请重新输入卡号!", vbOKOnly + vbExclamation, "提示您"
Exit Sub
txtCardno.Text = ""
txtCardno.SetFocus
Else
mrc.MoveNext
End If
Wend
mrc.AddNew
mrc.Fields(0) = Trim(txtCardno.Text)
mrc.Fields(1) = Trim(comboSchoolno.Text)
mrc.Fields(2) = Trim(txtCardvalue.Text)
mrc.Update
mrc.Close
MsgBox "添加卡级信息成功!", vbOKOnly + vbExclamation, "恭喜"
txtCardno.Text = ""
comboSchoolno.Text = ""
txtCardvalue.Text = "0"
txtCardstatue.Text = "正常"
txtCardvalue.Enabled = False
txtCardstatue.Enabled = False
frmAddcardinfo.Show
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim mrc As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
Dim i As Integer
txtSQL = "select * from school_Info "
Set mrc = ExecuteSQL(txtSQL, MsgText)
For i = 1 To mrc.RecordCount
comboSchoolno.AddItem mrc.Fields(0)
mrc.MoveNext
Next i
txtCardvalue.Text = "0"
txtCardstatue.Text = "正常"
txtCardvalue.Enabled = False
txtCardstatue.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -