?? frmdjgys.frm
字號:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmDJGYS
BorderStyle = 3 'Fixed Dialog
Caption = "供應商情況登記"
ClientHeight = 4260
ClientLeft = 45
ClientTop = 330
ClientWidth = 8580
Icon = "FrmDJGYS.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4260
ScaleWidth = 8580
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 7080
Top = 3240
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
Begin VB.CommandButton CmdReturn
Caption = "返回(&C)"
Height = 375
Left = 5880
TabIndex = 11
Top = 3600
Width = 1575
End
Begin VB.CommandButton CmdSaveReturn
Caption = "保存并返回(&D)"
Height = 375
Left = 3240
TabIndex = 10
Top = 3600
Width = 1575
End
Begin VB.CommandButton CmdSaveContinue
Caption = "保存并繼續(&S)"
Height = 375
Left = 600
TabIndex = 9
Top = 3600
Width = 1575
End
Begin VB.TextBox TxtJianJie
Height = 1935
Left = 5040
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 8
Top = 1215
Width = 3375
End
Begin VB.TextBox TxtWeb
Height = 390
Left = 5040
TabIndex = 7
Top = 720
Width = 3375
End
Begin VB.TextBox TxtLianXiRen
Height = 390
Left = 5040
TabIndex = 6
Top = 240
Width = 3375
End
Begin VB.TextBox TxtMail
Height = 390
Left = 1320
TabIndex = 5
Top = 2760
Width = 2535
End
Begin VB.TextBox TxtChuanZhen
Height = 390
Left = 1320
TabIndex = 4
Top = 2280
Width = 2535
End
Begin VB.TextBox TxtDianHua
Height = 390
Left = 1320
TabIndex = 3
Top = 1770
Width = 2535
End
Begin VB.TextBox TxtDiZhi
Height = 390
Left = 1320
TabIndex = 2
Top = 1260
Width = 2535
End
Begin VB.TextBox TxtDanWei
Height = 390
Left = 1320
TabIndex = 1
Top = 750
Width = 2535
End
Begin VB.TextBox TxtBianHao
Height = 390
Left = 1320
TabIndex = 0
Top = 240
Width = 2535
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "單位簡介:"
Height = 180
Left = 4080
TabIndex = 20
Top = 1338
Width = 900
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "單位主頁:"
Height = 180
Left = 4080
TabIndex = 19
Top = 849
Width = 900
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "聯系人:"
Height = 180
Left = 4260
TabIndex = 18
Top = 360
Width = 720
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "E-mail:"
Height = 180
Left = 480
TabIndex = 17
Top = 2760
Width = 720
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "傳真:"
Height = 180
Left = 585
TabIndex = 16
Top = 2310
Width = 540
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "電話:"
Height = 180
Left = 660
TabIndex = 15
Top = 1830
Width = 540
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "單位地址:"
Height = 180
Left = 300
TabIndex = 14
Top = 1335
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "單位名稱:"
Height = 180
Left = 300
TabIndex = 13
Top = 855
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "供應商編號:"
Height = 180
Left = 120
TabIndex = 12
Top = 360
Width = 1080
End
End
Attribute VB_Name = "FrmDJGYS"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Function checkGYSID(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 [供應商] 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
checkGYSID = True
Screen.MousePointer = vbDefault
Else
'關閉數據庫
userRD.Close
Set userRD = Nothing
userDB.Close
Set userDB = Nothing
Screen.MousePointer = vbDefault
checkGYSID = 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 CmdReturn_Click()
Unload Me
Load FrmGYS
FrmGYS.Show vbModal
End Sub
Private Sub CmdSaveContinue_Click()
On Error GoTo errEnd
If TxtBianHao.Text = "" Then
MsgBox "請輸入供應商編號!", vbOKOnly + vbExclamation, "供應商登記"
TxtBianHao.SetFocus
Exit Sub
End If
If TxtDanWei.Text = "" Then
MsgBox "請輸入單位名稱!", vbOKOnly + vbExclamation, "供應商登記"
TxtDanWei.SetFocus
Exit Sub
End If
If TxtDiZhi.Text = "" Then
MsgBox "請輸入供應商聯系地址!", vbOKOnly + vbExclamation, "供應商登記"
TxtDiZhi.SetFocus
Exit Sub
End If
If TxtDianHua.Text = "" Then
MsgBox "請輸入供應商聯系電話!", vbOKOnly + vbExclamation, "供應商登記"
TxtDianHua.SetFocus
Exit Sub
End If
If TxtChuanZhen.Text = "" Then TxtChuanZhen.Text = "未知"
If TxtMail.Text = "" Then TxtMail.Text = "無"
If TxtLianXiRen.Text = "" Then
MsgBox "請輸入聯系人姓名!", vbOKOnly + vbExclamation, "供應商登記"
TxtLianXiRen.SetFocus
Exit Sub
End If
If TxtWeb.Text = "" Then TxtWeb.Text = "無"
If TxtJianJie.Text = "" Then TxtJianJie.Text = "無"
If checkGYSID(TxtBianHao.Text) Then
MsgBox "供應商編號不唯一,請另選一個!", vbOKOnly + vbExclamation, "供應商登記"
TxtBianHao.SetFocus
TxtBianHao.SelStart = 0
TxtBianHao.SelLength = Len(TxtBianHao.Text)
Exit Sub
End If
Adodc1.Recordset.AddNew
Adodc1.Recordset!供應商編號 = TxtBianHao.Text
Adodc1.Recordset!供應商 = TxtDanWei.Text
Adodc1.Recordset!地址 = TxtDiZhi.Text
Adodc1.Recordset!網址 = TxtWeb.Text
Adodc1.Recordset!聯系人 = TxtLianXiRen.Text
Adodc1.Recordset!電話 = TxtDianHua.Text
Adodc1.Recordset!傳真 = TxtChuanZhen.Text
Adodc1.Recordset!電子郵件 = TxtMail.Text
Adodc1.Recordset!單位簡介 = TxtJianJie.Text
Adodc1.Recordset.Update
MsgBox "供應商情況登記成功!", vbOKOnly + vbInformation, "登記成功"
TxtBianHao.Text = ""
TxtDanWei.Text = ""
TxtDiZhi.Text = ""
TxtWeb.Text = ""
TxtLianXiRen.Text = ""
TxtChuanZhen.Text = ""
TxtDianHua.Text = ""
TxtMail.Text = ""
TxtJianJie.Text = ""
TxtBianHao.SetFocus
Exit Sub
errEnd:
MsgBox "更新數據庫失敗!", vbOKOnly + vbExclamation, "數據庫出錯"
End Sub
Private Sub CmdSaveReturn_Click()
On Error GoTo errEnd
If TxtBianHao.Text = "" Then
MsgBox "請輸入供應商編號!", vbOKOnly + vbExclamation, "供應商登記"
TxtBianHao.SetFocus
Exit Sub
End If
If TxtDanWei.Text = "" Then
MsgBox "請輸入單位名稱!", vbOKOnly + vbExclamation, "供應商登記"
TxtDanWei.SetFocus
Exit Sub
End If
If TxtDiZhi.Text = "" Then
MsgBox "請輸入供應商聯系地址!", vbOKOnly + vbExclamation, "供應商登記"
TxtDiZhi.SetFocus
Exit Sub
End If
If TxtDianHua.Text = "" Then
MsgBox "請輸入供應商聯系電話!", vbOKOnly + vbExclamation, "供應商登記"
TxtDianHua.SetFocus
Exit Sub
End If
If TxtChuanZhen.Text = "" Then TxtChuanZhen.Text = "未知"
If TxtMail.Text = "" Then TxtMail.Text = "無"
If TxtLianXiRen.Text = "" Then
MsgBox "請輸入聯系人姓名!", vbOKOnly + vbExclamation, "供應商登記"
TxtLianXiRen.SetFocus
Exit Sub
End If
If TxtWeb.Text = "" Then TxtWeb.Text = "無"
If TxtJianJie.Text = "" Then TxtJianJie.Text = "無"
If checkGYSID(TxtBianHao.Text) Then
MsgBox "供應商編號不唯一,請另選一個!", vbOKOnly + vbExclamation, "供應商登記"
TxtBianHao.SetFocus
TxtBianHao.SelStart = 0
TxtBianHao.SelLength = Len(TxtBianHao.Text)
Exit Sub
End If
Adodc1.Recordset.AddNew
Adodc1.Recordset!供應商編號 = TxtBianHao.Text
Adodc1.Recordset!供應商 = TxtDanWei.Text
Adodc1.Recordset!地址 = TxtDiZhi.Text
Adodc1.Recordset!網址 = TxtWeb.Text
Adodc1.Recordset!聯系人 = TxtLianXiRen.Text
Adodc1.Recordset!電話 = TxtDianHua.Text
Adodc1.Recordset!傳真 = TxtChuanZhen.Text
Adodc1.Recordset!電子郵件 = TxtMail.Text
Adodc1.Recordset!單位簡介 = TxtJianJie.Text
Adodc1.Recordset.Update
MsgBox "供應商情況登記成功!", vbOKOnly + vbInformation, "登記成功"
Call CmdReturn_Click
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
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "供應商"
Adodc1.Refresh
Exit Sub
errEnd:
MsgBox "連接數據庫失敗!", vbOKOnly + vbExclamation, "打開數據庫出錯"
End
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -