?? 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 + -