??
字號:
VERSION 5.00
Begin VB.Form 讀者登記1
BorderStyle = 1 'Fixed Single
Caption = "編輯讀者記錄"
ClientHeight = 4020
ClientLeft = 45
ClientTop = 435
ClientWidth = 4680
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4020
ScaleWidth = 4680
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Caption = "讀者記錄"
Height = 3735
Left = 120
TabIndex = 0
Top = 120
Width = 4455
Begin VB.CommandButton Command4
Caption = "…"
Height = 255
Left = 4080
TabIndex = 16
Top = 960
Width = 255
End
Begin VB.TextBox Text6
Height = 270
Left = 1080
TabIndex = 22
Top = 2760
Width = 975
End
Begin VB.ComboBox Combo2
Height = 300
Left = 2280
TabIndex = 15
Top = 960
Width = 1815
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 255
Left = 2400
TabIndex = 24
Top = 3240
Width = 855
End
Begin VB.CommandButton Command1
Caption = "確定"
Height = 255
Left = 600
TabIndex = 23
Top = 3240
Width = 855
End
Begin VB.TextBox Text3
Height = 270
Left = 1080
TabIndex = 19
Top = 2160
Width = 375
End
Begin VB.TextBox Text2
Height = 270
Left = 3000
TabIndex = 12
Top = 360
Width = 1335
End
Begin VB.TextBox Text1
Height = 270
Left = 960
TabIndex = 11
Top = 360
Width = 1335
End
Begin VB.Frame Frame3
Caption = "級別"
Height = 1095
Left = 120
TabIndex = 7
Top = 1440
Width = 4215
Begin VB.CommandButton Command3
Caption = "…"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 1800
TabIndex = 18
Top = 240
Width = 255
End
Begin VB.ComboBox Combo1
Height = 300
Left = 240
TabIndex = 17
Top = 240
Width = 1575
End
Begin VB.TextBox Text5
Height = 270
Left = 3600
TabIndex = 21
Text = "30"
Top = 720
Width = 375
End
Begin VB.TextBox Text4
Height = 270
Left = 2280
TabIndex = 20
Text = "10"
Top = 720
Width = 375
End
Begin VB.Label Label8
Caption = "借書天數"
Height = 255
Left = 2760
TabIndex = 10
Top = 720
Width = 735
End
Begin VB.Label Label7
Caption = "借書總數"
Height = 255
Left = 1440
TabIndex = 9
Top = 720
Width = 735
End
Begin VB.Label Label6
Caption = "過期罰款"
Height = 255
Left = 120
TabIndex = 8
Top = 720
Width = 735
End
End
Begin VB.Frame Frame2
Caption = "性 別"
Height = 615
Left = 120
TabIndex = 6
Top = 720
Width = 1335
Begin VB.OptionButton Option2
Caption = "女"
Height = 255
Left = 720
TabIndex = 14
Top = 240
Width = 495
End
Begin VB.OptionButton Option1
Caption = "男"
Height = 255
Left = 120
TabIndex = 13
Top = 240
Value = -1 'True
Width = 495
End
End
Begin VB.Label Label5
Caption = "<-日期格式:2001-9-1"
Height = 255
Left = 2280
TabIndex = 5
Top = 2760
Width = 1935
End
Begin VB.Label Label4
Caption = "登記日期*"
Height = 255
Left = 120
TabIndex = 4
Top = 2760
Width = 855
End
Begin VB.Label Label3
Caption = "單位*"
Height = 255
Left = 1680
TabIndex = 3
Top = 960
Width = 495
End
Begin VB.Label Label2
Caption = "姓名*"
Height = 255
Left = 2520
TabIndex = 2
Top = 360
Width = 495
End
Begin VB.Label Label1
Caption = "借書證號*"
Height = 255
Left = 120
TabIndex = 1
Top = 360
Width = 855
End
End
End
Attribute VB_Name = "讀者登記1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub combo1_keypress(KeyAscii As Integer)
Call endata(KeyAscii)
End Sub
Private Sub combo2_keypress(KeyAscii As Integer)
Call endata(KeyAscii)
End Sub
Private Sub Command1_Click() '確定
If Trim(Text1.Text) = "" Or Trim(Text2.Text) = "" _
Or Trim(Text6.Text) = "" Or Trim(Combo1.Text) = "" Then
MsgBox "加*數據不能為空,請重新設置", vbOKOnly, "信息提示"
Exit Sub
End If
sqltxt = "select * from reader where 借書證號='" + _
Trim(Text1.Text) + "'" '對reader中記錄進行判斷
Set rs = exesql(sqltxt)
If flag = 1 Then '添加操作,先判斷是否存在相同借書證號的讀者
If rs.RecordCount <> 0 Then
MsgBox "存在相同的借書證號", vbOKOnly, "信息提示"
Text1.SetFocus
rs.Close
Exit Sub
End If
rs.AddNew
rs.Fields("借書證號") = Trim(Text1.Text)
rs.Fields("姓名") = Trim(Text2.Text)
If Option1.Value = True Then
rs.Fields("性別") = "男"
Else
rs.Fields("性別") = "女"
End If
rs.Fields("級別") = Trim(Combo1.Text)
rs.Fields("單位") = Trim(Combo2.Text)
rs.Fields("過期罰款") = Trim(Text3.Text)
rs.Fields("借書總數") = Val(Trim(Text4.Text))
rs.Fields("借書天數") = Val(Trim(Text5.Text))
rs.Fields("已借書數") = 0
rs.Fields("登記日期") = Format(Trim(Text6.Text), "yyyy-mm-dd")
rs.Update
recs = recs + 1
Else '修改操作,判斷是否存在相同借書證號的讀者
rs.Fields("借書證號") = Trim(Text1.Text)
rs.Fields("姓名") = Trim(Text2.Text)
If Option1.Value = True Then
rs.Fields("性別") = "男"
Else
rs.Fields("性別") = "女"
End If
rs.Fields("級別") = Trim(Combo1.Text)
rs.Fields("單位") = Trim(Combo2.Text)
rs.Fields("過期罰款") = Trim(Text3.Text)
rs.Fields("借書總數") = Val(Trim(Text4.Text))
rs.Fields("借書天數") = Val(Trim(Text5.Text))
rs.Fields("已借書數") = 0
rs.Fields("登記日期") = Format(Trim(Text6.Text), "yyyy-mm-dd")
rs.Update
End If
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
xnum = ""
End Sub
Private Sub Command3_Click()
添加級別.Show vbModal '以模式方式調用edrec窗體編輯讀者級別記錄
End Sub
Private Sub Command4_Click()
tna = "depart"
cap = "單位"
編輯信息.Show vbModal '以模式方式調用edrec窗體編號單位記錄
End Sub
Private Sub Form_Load()
Dim sqltxt As String
Dim sqltxt1 As String
Dim i As Integer
sqltxt = "select * from rlevel "
Set rs = exesql(sqltxt)
'Combo1.Text = rs.Fields("級別")
For i = 1 To rs.RecordCount
Combo1.AddItem rs.Fields("級別")
rs.MoveNext
Next i
sqltxt = "select * from depart "
Set rs = exesql(sqltxt)
'Combo2.Text = rs.Fields("fn")
For i = 1 To rs.RecordCount
Combo2.AddItem rs.Fields("fn")
rs.MoveNext
Next i
If flag = 2 Then '修改操作
Text1.Text = xnum
sqltxt1 = "select * from reader where 借書證號='" + xnum + "'"
Set brs = exesql(sqltxt1)
Text2.Text = brs.Fields("姓名")
Text3.Text = brs.Fields("過期罰款")
Text4.Text = brs.Fields("借書總數")
Text5.Text = brs.Fields("借書天數")
Text6.Text = brs.Fields("登記日期")
If brs.Fields("性別") = "男" Then
Option1.Value = True
Else
Option2.Value = True
End If
Combo1.Text = brs.Fields("級別")
Combo2.Text = brs.Fields("單位")
Text1.Enabled = False
Else
Text6.Text = Date '添加操作
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
xnum = ""
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Call endata(KeyAscii)
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -