📄 frmbookedit.frm
字号:
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 240
TabIndex = 15
Top = 1320
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 = 240
TabIndex = 13
Top = 3240
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 = 240
TabIndex = 12
Top = 2760
Width = 720
End
Begin VB.Label Label8
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "图书名称"
Height = 180
Left = 240
TabIndex = 10
Top = 840
Width = 720
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 = 240
TabIndex = 9
Top = 1800
Width = 720
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 = 240
TabIndex = 8
Top = 2280
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 = 240
TabIndex = 7
Top = 360
Width = 720
End
End
End
Attribute VB_Name = "FrmBookEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean '插入=false,修改=true
Public OriNo As String '原始图书编号
Public nBookTypeId As Integer '图书分类编号
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
'检查用户录入数据的有效性
If Len(Trim(txtBookNo)) = 0 Then
MsgBox "请您输入图书编号! ", 64, "提示"
txtBookNo.SetFocus
txtBookNo.SelStart = 0
txtBookNo.SelLength = Len(txtBookNo)
Exit Sub
End If
If Len(Trim(txtBookName)) = 0 Then
MsgBox "请您输入图书名称! ", 64, "提示"
txtBookName.SetFocus
txtBookName.SelStart = 0
txtBookName.SelLength = Len(txtBookName)
Exit Sub
End If
If Len(Trim(txtPublisher)) = 0 Then
MsgBox "请您输入出版社名称! ", 64, "提示"
txtPublisher.SetFocus
txtPublisher.SelStart = 0
txtPublisher.SelLength = Len(txtPublisher)
Exit Sub
End If
If Len(Trim(txtPrice)) = 0 Then
MsgBox "请您输入图书价格! ", 64, "提示"
txtPrice.SetFocus
txtPrice.SelStart = 0
txtPrice.SelLength = Len(txtPrice)
Exit Sub
End If
'判断图书编号是否存在,如果是修改记录,则当编号变化时才做判断
If Modify = False Then
If MyBookInfo.HaveNo(Trim(txtBookNo)) Then
MsgBox "对不起!此图书编号已经存在! ", 64, "提示"
Exit Sub
End If
Else
If Trim(txtBookNo) <> OriNo And MyBookInfo.HaveNo(Trim(txtBookNo)) Then
MsgBox "对不起!此图书编号已经存在! ", 64, "提示"
Exit Sub
End If
End If
'把用户录入的数据赋值到数据库对象变量中
With MyBookInfo
.BookNo = MakeStr(txtBookNo) '图书编号
.BookName = MakeStr(txtBookName) '图书名称
.Publisher = MakeStr(txtPublisher) '出版社
.Author = MakeStr(txtAuthor) '作者
.Location = MakeStr(txtLocation) '存放位置
.Price = Val(txtPrice) '价格
.Total = Val(txtTotal) '数量
.TypeId = nBookTypeId '图书分类
.Description = MakeStr(txtDescription)
'根据变量Modify的值,决定是插入新数据,还是修改已有的数据
If Modify = False Then
.Insert
Cmd_OK.Enabled = False
Else
Call .Update(OriNo)
End If
End With
Unload Me
End Sub
Private Sub txtAuthor_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtBookName_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtBookNo_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtPrice_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Single(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
Private Sub txtLocation_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtPublisher_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -