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

📄 main_gys.frm

📁 毕业论文 看看 毕业论文 看看 毕业论文 看看
💻 FRM
📖 第 1 页 / 共 3 页
字号:
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Index           =   0
            Left            =   1350
            TabIndex        =   14
            Top             =   345
            Width           =   7335
         End
         Begin VB.Label Label5 
            Caption         =   "开户银行:             银行账号:             纳税人登记:"
            BeginProperty Font 
               Name            =   "宋体"
               Size            =   10.5
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   1200
            Left            =   195
            TabIndex        =   33
            Top             =   3300
            Width           =   1200
         End
         Begin VB.Label Label8 
            Caption         =   "网址邮箱:"
            BeginProperty Font 
               Name            =   "宋体"
               Size            =   10.5
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   195
            TabIndex        =   32
            Top             =   4590
            Width           =   1200
         End
         Begin VB.Label Label2 
            Caption         =   "联系人:"
            BeginProperty Font 
               Name            =   "宋体"
               Size            =   10.5
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   195
            TabIndex        =   31
            Top             =   2850
            Width           =   1185
         End
         Begin VB.Label Label4 
            BackStyle       =   0  'Transparent
            Caption         =   "传真:                   联系人电话:"
            BeginProperty Font 
               Name            =   "宋体"
               Size            =   10.5
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   690
            Left            =   5565
            TabIndex        =   30
            Top             =   2505
            Width           =   1260
         End
         Begin VB.Label Label3 
            Caption         =   "邮政编码:"
            BeginProperty Font 
               Name            =   "宋体"
               Size            =   10.5
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   270
            Left            =   5580
            TabIndex        =   29
            Top             =   2070
            Width           =   1020
         End
         Begin VB.Label Label1 
            Caption         =   "供应商编号:             供应商全称:           供应商简称:            供应商地址:            所属地区:             电话: "
            BeginProperty Font 
               Name            =   "宋体"
               Size            =   10.5
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   2400
            Left            =   195
            TabIndex        =   28
            Top             =   375
            Width           =   1200
         End
      End
   End
End
Attribute VB_Name = "main_gys"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer     '定义整型变量
'定义数据集对象
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim rs3 As New ADODB.Recordset
Dim rs4 As New ADODB.Recordset
Public Sub View_data()     '定义显示数据的函数
 For i = 0 To 13
  If Adodc1.Recordset.RecordCount <> 0 Then gys(i).text = Adodc1.Recordset.Fields(i)
 Next i
End Sub
Private Sub Form_Activate()
 '向combo1中添加查询项目列表
 Combo1.AddItem ("供应商编号")
 Combo1.AddItem ("供应商全称")
 Set rs1 = New ADODB.Recordset
 '打开"供应商信息表"
 rs1.Open "select * from 供应商信息表 order by 供应商编号", cnn, adOpenKeyset, adLockOptimistic
 If rs1.RecordCount > 0 Then
  For i = 0 To 13
   If rs1.Fields(i) <> "" Then gys(i).text = rs1.Fields(i)
  Next i
 End If
 rs1.Close
 '查询所有供应商信息,并按"供应商编号"排序
 Adodc1.RecordSource = "select * from 供应商信息表 order by 供应商编号"
 Adodc1.Refresh
 Me.Caption = Me.Caption & "    " & frm_main.St1.Panels(3).text
End Sub
Private Sub Form_Unload(Cancel As Integer)
 frm_main.Enabled = True
End Sub
Private Sub gys_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
 If KeyCode = vbKeyReturn And Index < 13 Then gys(Index + 1).SetFocus '回车获得焦点
 If KeyCode = vbKeyReturn And Index = 13 Then ComSave.SetFocus
End Sub
Private Sub SSTab1_Click(PreviousTab As Integer)
 If Adodc1.Recordset.RecordCount <> 0 Then
  If SSTab1.Tab = 1 And ComAdd.Enabled = False Then
   MsgBox ("您正在处理数据,请取消数据处理,在执行本操作!")
   SSTab1.Tab = 0
  End If
 End If
End Sub
Private Sub Comfind_Click()
 Adodc1.RecordSource = "select * from 供应商信息表 where (供应商信息表." & Combo1.text & " like +'%'+ '" + Text1.text + "'+'%')"
 Adodc1.Refresh
 Call View_data
 SSTab1.Tab = 1
End Sub
Private Sub CmdMD_Click(Index As Integer)
 Select Case Index
 Case Is = 0     '移到第一条记录
  If Not Adodc1.Recordset.BOF Then Adodc1.Recordset.MoveFirst
 Case Is = 1     '移到上一条记录
  If Adodc1.Recordset.RecordCount <> 0 Then
   If Adodc1.Recordset.BOF = False Then Adodc1.Recordset.MovePrevious
   If Adodc1.Recordset.BOF = True Then Adodc1.Recordset.MoveFirst
  End If
 Case Is = 2     '移到下一条记录
  If Adodc1.Recordset.RecordCount <> 0 Then
   If Adodc1.Recordset.EOF = False Then Adodc1.Recordset.MoveNext
   If Adodc1.Recordset.EOF = True Then Adodc1.Recordset.MoveLast
  End If
 Case Is = 3     '移到最后一条记录
   If Adodc1.Recordset.EOF = False Then Adodc1.Recordset.MoveLast
 End Select
 Call View_data
End Sub
Private Sub ComAdd_Click()     '添加
 '创建供应商编号
 Dim bh As Integer
 rs1.Open "select * from 供应商信息表 order by 供应商编号", cnn, adOpenKeyset, adLockOptimistic
 If rs1.RecordCount > 0 Then
    If Not rs1.EOF Then rs1.MoveLast
    If rs1.Fields("供应商编号") <> "" Then
     bh = Right(Trim(rs1.Fields("供应商编号")), 4) + 1
     gys(0).text = "gys" & Format(bh, "0000")
    End If
   Else
    gys(0).text = "gys0001"
  End If
  rs1.Close
  For i = 1 To 13
   gys(i).Enabled = True
   gys(i).text = ""
  Next i
  '设置控件不可用
  ComSave.Enabled = True: ComEsc.Enabled = True: ComAdd.Enabled = False
  ComModify.Enabled = False: ComDelete.Enabled = False
  For i = 0 To 3
   CmdMD(i).Enabled = False
  Next i
  SSTab1.Tab = 0
  gys(1).SetFocus
End Sub
Private Sub ComModify_Click()     '允许修改记录
 If Adodc1.Recordset.RecordCount <> 0 Then
  For i = 0 To 13
   gys(i).Enabled = True
  Next i
  ComSave.Enabled = True: ComEsc.Enabled = True: ComAdd.Enabled = False
  ComModify.Enabled = False: ComDelete.Enabled = False
  For i = 0 To 3
   CmdMD(i).Enabled = False
  Next i
 Else
  MsgBox ("没有要修改的数据!")
End If
End Sub
Private Sub ComDelete_Click()     '删除记录
 If Adodc1.Recordset.RecordCount > 0 Then
   a = MsgBox("您确实要删除这条数据吗?", vbYesNo)
   If a = vbYes Then
    Adodc1.Recordset.Delete
    Adodc1.Refresh
    Call View_data     '调用函数
    End If
    ComSave.Enabled = False: ComEsc.Enabled = False: ComAdd.Enabled = True
    ComModify.Enabled = True: ComDelete.Enabled = True
    For i = 0 To 3
     CmdMD(i).Enabled = True
    Next i
  Else
   MsgBox ("没有要删除的数据!")
 End If
End Sub
Private Sub ComSave_Click()     '保存供应商信息
 rs1.Open "select * from 供应商信息表 where 供应商编号='" & Trim(gys(0).text) & "'order by 供应商编号", cnn, adOpenKeyset, adLockOptimistic
 If rs1.RecordCount > 0 Then
   Dim a As String
   a = MsgBox("您确实要修改这条数据吗?", vbYesNo)
   If a = vbYes Then
    For i = 1 To 13
        If gys(1).text <> "" Then rs1.Fields(i) = Trim(gys(i).text)
        gys(i).Enabled = False
    Next i
    rs1.Update
    Adodc1.Refresh
   End If
  Else
   If gys(1).text <> "" And gys(2).text <> "" Then
      '添加供应商信息
      rs1.AddNew
      For i = 0 To 13
          rs1.Fields(i) = Trim(gys(i).text)
          gys(i).Enabled = False
      Next i
       rs1.Update     '更新数据库
       Adodc1.Refresh
    Else
       MsgBox "请填写完整的信息"
   End If
 End If
 rs1.Close     '关闭数据集对象
 '设置控件不可用
 ComSave.Enabled = False: ComEsc.Enabled = False: ComAdd.Enabled = True
 ComModify.Enabled = True: ComDelete.Enabled = True
 For i = 0 To 3
  CmdMD(i).Enabled = True
 Next i
End Sub
Private Sub ComEsc_Click()    '取消操作
 rs1.Open "select * from 供应商信息表 order by 供应商编号", cnn, adOpenKeyset, adLockOptimistic
 If rs1.RecordCount > 0 Then
  For i = 0 To 13
   If rs1.Fields(i) <> "" Then gys(i).text = rs1.Fields(i)
   gys(i).Enabled = False
  Next i
 End If
 rs1.Close
 ComSave.Enabled = False: ComEsc.Enabled = False: ComAdd.Enabled = True
 ComModify.Enabled = True: ComDelete.Enabled = True
 For i = 0 To 3
  CmdMD(i).Enabled = True
 Next i
End Sub
Private Sub ComExit_Click()
 frm_main.Enabled = True
 Unload Me
End Sub

⌨️ 快捷键说明

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