⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmgys.frm

📁 图书销售信息系统有毕业设计和源码在先进的计算机技术支持下
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmGYS 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "新书入库   选择供应商"
   ClientHeight    =   5160
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   8850
   Icon            =   "FrmGYS.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5160
   ScaleWidth      =   8850
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   4200
      Top             =   3960
      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.Frame Frame2 
      Caption         =   "信息管理"
      Height          =   975
      Left            =   120
      TabIndex        =   14
      Top             =   3960
      Width           =   8535
      Begin VB.CommandButton CmdSelect 
         Caption         =   "选中供应商(&G)"
         Height          =   375
         Left            =   2440
         TabIndex        =   10
         Top             =   360
         Width           =   1575
      End
      Begin VB.CommandButton CmdClose 
         Cancel          =   -1  'True
         Caption         =   "关闭(&C)"
         Height          =   375
         Left            =   6600
         TabIndex        =   12
         Top             =   360
         Width           =   1575
      End
      Begin VB.CommandButton CmdUpdate 
         Caption         =   "修改资料(&U)"
         Height          =   375
         Left            =   4520
         TabIndex        =   11
         Top             =   360
         Width           =   1575
      End
      Begin VB.CommandButton CmdNewGYS 
         Caption         =   "供应商登记(&N)"
         Height          =   375
         Left            =   360
         TabIndex        =   9
         Top             =   360
         Width           =   1575
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "选择供应商"
      Height          =   3615
      Left            =   120
      TabIndex        =   13
      Top             =   120
      Width           =   8535
      Begin VB.TextBox TxtJianJie 
         Height          =   1935
         Left            =   5160
         MultiLine       =   -1  'True
         ScrollBars      =   3  'Both
         TabIndex        =   8
         Top             =   1335
         Width           =   3135
      End
      Begin VB.TextBox TxtWeb 
         Height          =   390
         Left            =   5160
         TabIndex        =   7
         Top             =   840
         Width           =   3135
      End
      Begin VB.TextBox TxtLianXiRen 
         Height          =   390
         Left            =   5160
         TabIndex        =   6
         Top             =   360
         Width           =   3135
      End
      Begin VB.TextBox TxtMail 
         Height          =   390
         Left            =   1440
         TabIndex        =   5
         Top             =   2880
         Width           =   2535
      End
      Begin VB.TextBox TxtChuanZhen 
         Height          =   390
         Left            =   1440
         TabIndex        =   4
         Top             =   2400
         Width           =   2535
      End
      Begin VB.TextBox TxtDianHua 
         Height          =   390
         Left            =   1440
         TabIndex        =   3
         Top             =   1890
         Width           =   2535
      End
      Begin VB.TextBox TxtDiZhi 
         Height          =   390
         Left            =   1440
         TabIndex        =   2
         Top             =   1380
         Width           =   2535
      End
      Begin VB.TextBox TxtDanWei 
         Height          =   390
         Left            =   1440
         TabIndex        =   1
         Top             =   870
         Width           =   2535
      End
      Begin VB.ComboBox ComboDanWei 
         Height          =   300
         Left            =   1440
         TabIndex        =   0
         Text            =   "请选择供应商"
         Top             =   360
         Width           =   2535
      End
      Begin VB.Label Label10 
         AutoSize        =   -1  'True
         Caption         =   "单位简介:"
         Height          =   180
         Left            =   4200
         TabIndex        =   23
         Top             =   1440
         Width           =   900
      End
      Begin VB.Label Label9 
         AutoSize        =   -1  'True
         Caption         =   "单位主页:"
         Height          =   180
         Left            =   4200
         TabIndex        =   22
         Top             =   960
         Width           =   900
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         Caption         =   "联系人:"
         Height          =   180
         Left            =   4380
         TabIndex        =   21
         Top             =   480
         Width           =   720
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "E-mail:"
         Height          =   180
         Left            =   600
         TabIndex        =   20
         Top             =   3000
         Width           =   720
      End
      Begin VB.Label Label6 
         Caption         =   "传真:"
         Height          =   255
         Left            =   705
         TabIndex        =   19
         Top             =   2520
         Width           =   615
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "电话:"
         Height          =   180
         Left            =   780
         TabIndex        =   18
         Top             =   2010
         Width           =   540
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "单位地址:"
         Height          =   180
         Left            =   420
         TabIndex        =   17
         Top             =   1515
         Width           =   900
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "单位名称:"
         Height          =   180
         Left            =   420
         TabIndex        =   16
         Top             =   1005
         Width           =   900
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "选择供应商:"
         Height          =   180
         Left            =   240
         TabIndex        =   15
         Top             =   480
         Width           =   1080
      End
   End
End
Attribute VB_Name = "FrmGYS"
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 CmdClose_Click()
Unload Me
End Sub

Private Sub CmdNewGYS_Click()
Unload Me
Load FrmDJGYS
FrmDJGYS.Show vbModal
End Sub

Private Sub CmdSelect_Click()
If ComboDanWei.Text <> "" And ComboDanWei.Text <> "请选择供应商" Then
    If checkGYSID(ComboDanWei.Text) Then
        '新书登记
        GongYingShangID = ComboDanWei.Text
        Unload Me
        Load FrmBook
        FrmBook.Show vbModal
    Else
        MsgBox "该供应商不存在,请先选择或登记!", vbOKOnly + vbExclamation, "选择供应商"
        ComboDanWei.SetFocus
    End If
Else
    MsgBox "请选择供应商!", vbOKOnly + vbExclamation, "选择供应商"
    ComboDanWei.SetFocus
End If
End Sub

Private Sub CmdUpdate_Click()
On Error GoTo errEnd
Dim res As Integer

res = MsgBox("你确定要修改当前记录吗?", vbYesNo + vbQuestion, "确认更新")
If res = vbNo Then Exit Sub

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 = "无"

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, "供应商资料修改"
Exit Sub

errEnd:
    MsgBox "更新数据库失败!", vbOKOnly + vbExclamation, "数据库出错"
End Sub

Private Sub ComboDanWei_Click()
On Error GoTo errEnd

If ComboDanWei.Text <> "" And ComboDanWei.Text <> "请选择供应商" Then
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = "select * from [供应商] where [供应商编号]=""" & ComboDanWei.Text & """"
    Adodc1.Refresh
    Adodc1.Recordset.MoveFirst
    
    TxtDanWei.Text = Adodc1.Recordset!供应商 & ""
    GongYingShang = 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!单位简介 & ""
    
End If
Exit Sub

errEnd:
    MsgBox "检索数据库失败!", vbOKOnly + vbExclamation, "数据库出错"
End Sub

Private Sub Form_Activate()
On Error GoTo errEnd

ComboDanWei.Text = "请选择供应商"
If Adodc1.Recordset.RecordCount > 0 Then
    While Not Adodc1.Recordset.EOF
        ComboDanWei.AddItem Adodc1.Recordset!供应商编号
        Adodc1.Recordset.MoveNext
    Wend
Else
    MsgBox "目前没有供应商,请先登记供应商情况!", vbOKOnly + vbExclamation, "没有记录"
    CmdSelect.Enabled = False
    CmdUpdate.Enabled = False
End If
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
Adodc1.Recordset.MoveFirst

Exit Sub

errEnd:
    MsgBox "连接数据库失败!", vbOKOnly + vbExclamation, "打开数据库出错"
    End
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -