📄 frmthbook.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmTHBook
BorderStyle = 3 'Fixed Dialog
Caption = "办理退货 选择品种"
ClientHeight = 5835
ClientLeft = 45
ClientTop = 330
ClientWidth = 9570
Icon = "FrmTHBook.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5835
ScaleWidth = 9570
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame2
Caption = "信息管理"
Height = 975
Left = 120
TabIndex = 25
Top = 4680
Width = 9255
Begin VB.CommandButton CmdClose
Cancel = -1 'True
Caption = "取消(&C)"
Height = 375
Left = 5520
TabIndex = 2
Top = 360
Width = 1575
End
Begin VB.CommandButton CmdUpdate
Caption = "选中图书(&D)"
Height = 375
Left = 1800
TabIndex = 1
Top = 360
Width = 1575
End
End
Begin VB.Frame Frame1
Caption = "图书资料"
Height = 4335
Left = 120
TabIndex = 3
Top = 120
Width = 9255
Begin VB.TextBox TxtGuanJianCi
Height = 390
Left = 5160
TabIndex = 13
Top = 1440
Width = 3855
End
Begin VB.TextBox TxtCongShu
BeginProperty DataFormat
Type = 0
Format = "0"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
Height = 390
Left = 5160
TabIndex = 12
Top = 900
Width = 3855
End
Begin VB.TextBox TxtDingJia
BeginProperty DataFormat
Type = 1
Format = "0.00"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 1
EndProperty
Height = 390
Left = 1440
TabIndex = 11
Top = 3060
Width = 2535
End
Begin VB.TextBox TxtBook
Height = 390
Left = 1440
TabIndex = 10
Top = 900
Width = 2535
End
Begin VB.TextBox TxtChuBanShe
Height = 390
Left = 1440
TabIndex = 9
Top = 1440
Width = 2535
End
Begin VB.TextBox TxtZuoZhe
Height = 390
Left = 1440
TabIndex = 8
Top = 1980
Width = 2535
End
Begin VB.TextBox TxtChuBanRQ
Height = 390
Left = 1440
TabIndex = 7
Top = 2520
Width = 2535
End
Begin VB.TextBox TxtBanCi
Height = 390
Left = 1440
TabIndex = 6
Top = 3600
Width = 2535
End
Begin VB.TextBox TxtISBN
Height = 390
Left = 5160
TabIndex = 5
Top = 360
Width = 3855
End
Begin VB.TextBox TxtJianJie
Height = 1935
Left = 5160
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 4
Top = 2055
Width = 3855
End
Begin VB.TextBox TxtBianHao
Height = 390
Left = 1440
TabIndex = 0
Top = 360
Width = 2535
End
Begin VB.Label Label13
AutoSize = -1 'True
Caption = "关键词:"
Height = 180
Left = 4380
TabIndex = 24
Top = 1560
Width = 720
End
Begin VB.Label Label12
AutoSize = -1 'True
Caption = "丛书:"
Height = 180
Left = 4560
TabIndex = 23
Top = 1035
Width = 540
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "定价:"
Height = 180
Left = 780
TabIndex = 22
Top = 3120
Width = 540
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "图书编号:"
Height = 180
Left = 420
TabIndex = 21
Top = 480
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "图书名称:"
Height = 180
Left = 420
TabIndex = 20
Top = 1005
Width = 900
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "出版社:"
Height = 180
Left = 600
TabIndex = 19
Top = 1530
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "作者:"
Height = 180
Left = 780
TabIndex = 18
Top = 2055
Width = 540
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "出版日期:"
Height = 180
Left = 420
TabIndex = 17
Top = 2595
Width = 900
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "版次:"
Height = 180
Left = 780
TabIndex = 16
Top = 3720
Width = 540
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "ISBN:"
Height = 180
Left = 4560
TabIndex = 15
Top = 480
Width = 540
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "内容简介:"
Height = 180
Left = 4200
TabIndex = 14
Top = 2040
Width = 900
End
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 3840
Top = 4440
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
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
End
Attribute VB_Name = "FrmTHBook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Function checkBook(bianHao As String) As Boolean
On Error GoTo errEnd
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from [进书记录] where [供应商编号]=""" & GongYingShangID & """ and [图书编号]=""" & bianHao & """"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
checkBook = True
Else
checkBook = False
End If
Exit Function
errEnd:
MsgBox "检索失败!" & Err.Description, vbOKOnly + vbExclamation, "检索错误"
checkBook = False
End Function
Public Function checkFenLei(UID As String) As Boolean
Dim userDB As Database
Dim userRD As Recordset
Dim dbName As String
Dim STRSQL As String
Screen.MousePointer = 11
On Error GoTo errEnd
dbName = App.Path
If Right(dbName, 1) <> "\" Then dbName = dbName + "\"
dbName = dbName + "DataBase\WFSSDataBase.mdb"
STRSQL = "select [图书编号] from [Book] where [图书编号]=""" & UID & """"
'打开数据库
Set userDB = DBEngine.Workspaces(0).OpenDatabase(dbName, False, True)
'检索用户,验证密码
Set userRD = userDB.OpenRecordset(STRSQL, dbOpenSnapshot)
If userRD.RecordCount > 0 Then
'关闭数据库
userRD.Close
Set userRD = Nothing
userDB.Close
Set userDB = Nothing
checkFenLei = True
Screen.MousePointer = vbDefault
Else
'关闭数据库
userRD.Close
Set userRD = Nothing
userDB.Close
Set userDB = Nothing
Screen.MousePointer = vbDefault
checkFenLei = False
End If
Exit Function
errEnd:
Screen.MousePointer = vbDefault
MsgBox Err.Description, vbOKOnly + vbExclamation, "图书销售"
Err.Clear
'关闭数据库
userRD.Close
Set userRD = Nothing
userDB.Close
Set userDB = Nothing
End Function
Private Sub CmdClose_Click()
Unload Me
End Sub
Private Sub CmdUpdate_Click()
On Error GoTo errEnd
If TxtBianHao.Text = "" Then
MsgBox "请填写图书编号!", vbOKOnly + vbExclamation, "图书销售"
TxtBianHao.SetFocus
Exit Sub
End If
If Not checkFenLei(TxtBianHao.Text) Then
MsgBox "该图书编号不存在,请重试!", vbOKOnly + vbExclamation, "图书销售"
TxtBianHao.SelStart = 0
TxtBianHao.SelLength = Len(TxtBianHao.Text)
TxtBianHao.SetFocus
Exit Sub
End If
If Not checkBook(TxtBianHao.Text) Then
MsgBox "所选供应商没有该品种的相关进书记录!", vbOKOnly + vbExclamation, "没有进货记录"
TxtBianHao.SelStart = 0
TxtBianHao.SelLength = Len(TxtBianHao.Text)
TxtBianHao.SetFocus
Exit Sub
End If
'下一步
Unload Me
Load FrmTHGYS
FrmTHGYS.Show vbModal
Exit Sub
errEnd:
MsgBox "检索数据库失败!无法找到相关记录!", vbOKOnly + vbExclamation, "数据库出错"
End Sub
Private Sub Form_Load()
Dim dbName As String
Dim connSTR As String
On Error GoTo errEnd
ChDir App.Path
dbName = App.Path
If Right(dbName, 1) <> "\" Then dbName = dbName + "\"
dbName = dbName + "DataBase\WFSSDataBase.mdb"
connSTR = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbName & ";Persist Security Info=False"
Adodc1.ConnectionString = connSTR
Exit Sub
errEnd:
MsgBox "连接数据库失败!", vbOKOnly + vbExclamation, "打开数据库出错"
End
End Sub
Private Sub TxtBianHao_LostFocus()
On Error GoTo errEnd
If TxtBianHao.Text <> "" Then
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from [Book] where [图书编号]=""" & TxtBianHao.Text & """"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
'图书编号
TuShuBianHao = Adodc1.Recordset!图书编号 & ""
TxtBook.Text = Adodc1.Recordset!书名 & ""
'书名
ShuMing = Adodc1.Recordset!书名 & ""
TxtChuBanShe.Text = Adodc1.Recordset!出版社 & ""
TxtZuoZhe.Text = Adodc1.Recordset!作者 & ""
TxtChuBanRQ.Text = Adodc1.Recordset!出版日期 & ""
TxtDingJia.Text = Adodc1.Recordset!定价 & ""
'定价
DingJia = Adodc1.Recordset!定价 & ""
TxtBanCi.Text = Adodc1.Recordset!版次 & ""
TxtISBN.Text = Adodc1.Recordset!ISBN & ""
TxtCongShu.Text = Adodc1.Recordset!丛书 & ""
TxtGuanJianCi.Text = Adodc1.Recordset!关键词 & ""
TxtJianJie.Text = Adodc1.Recordset!内容简介 & ""
Else
MsgBox "该图书编号不存在!", vbOKOnly + vbExclamation, "图书销售"
TxtBianHao.SelStart = 0
TxtBianHao.SelLength = Len(TxtBianHao.Text)
TxtBianHao.SetFocus
Exit Sub
End If
End If
Exit Sub
errEnd:
MsgBox "检索数据库失败!", vbOKOnly + vbExclamation, "数据库出错"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -