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

📄 frmperson.frm

📁 vb写得进销存
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Width           =   360
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "身份证"
         Height          =   180
         Left            =   4695
         TabIndex        =   6
         Top             =   975
         Width           =   540
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "性别"
         Height          =   180
         Left            =   330
         TabIndex        =   5
         Top             =   975
         Width           =   360
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "出生年月"
         Height          =   180
         Left            =   4560
         TabIndex        =   4
         Top             =   480
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "姓名"
         Height          =   180
         Left            =   330
         TabIndex        =   2
         Top             =   525
         Width           =   360
      End
   End
   Begin MSComctlLib.ImageList ImageList2 
      Left            =   8805
      Top             =   600
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   32
      ImageHeight     =   32
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   11
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmPerson.frx":003E
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmPerson.frx":0492
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmPerson.frx":08E6
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmPerson.frx":0D3A
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmPerson.frx":118E
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmPerson.frx":15E2
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmPerson.frx":1A36
            Key             =   ""
         EndProperty
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmPerson.frx":1E8A
            Key             =   ""
         EndProperty
         BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmPerson.frx":22DE
            Key             =   ""
         EndProperty
         BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmPerson.frx":4FE8
            Key             =   ""
         EndProperty
         BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmPerson.frx":6CF2
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Align           =   1  'Align Top
      Height          =   795
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   9240
      _ExtentX        =   16298
      _ExtentY        =   1402
      ButtonWidth     =   1032
      ButtonHeight    =   1349
      Appearance      =   1
      Style           =   1
      ImageList       =   "ImageList2"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   11
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "加入"
            ImageIndex      =   1
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "删除"
            ImageIndex      =   3
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "修改"
            ImageIndex      =   4
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "查询"
            ImageIndex      =   11
         EndProperty
         BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "打印"
            ImageIndex      =   10
         EndProperty
         BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "退出"
            ImageIndex      =   9
         EndProperty
         BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.Visible         =   0   'False
            Caption         =   "确定"
            ImageIndex      =   6
         EndProperty
         BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.Visible         =   0   'False
            Caption         =   "取消"
            ImageIndex      =   7
         EndProperty
      EndProperty
      BorderStyle     =   1
   End
End
Attribute VB_Name = "frmPerson"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'20

Private Mode As String
Dim s As String

Private Sub DG_Change()
On Error GoTo eH
    If g_rst.State = 1 Then g_rst.Close
    Combo2.Clear
    g_rst.Open "select distinct(民族) as mz from 工作人员"
    While Not g_rst.EOF
        If Not IsNull(g_rst!mz) Then Combo2.AddItem g_rst!mz
        g_rst.MoveNext
    Wend
Exit Sub
eH:
    MsgBox em & vbNewLine & "错误号:2001" & vbNewLine & "错误描述:" & Err.Description

End Sub

Private Sub Form_Load()
On Error GoTo eH
    cText (True)
    
    If g_rst.State = 1 Then g_rst.Close
    Combo2.Clear
    g_rst.Open "select distinct(民族) as mz from 工作人员"
    While Not g_rst.EOF
        If Not IsNull(g_rst!mz) Then Combo2.AddItem g_rst!mz
        g_rst.MoveNext
    Wend
    
    ADO.ConnectionString = g_cnnStr
    ADO.RecordSource = "select * from 工作人员"
    ADO.Refresh
Exit Sub
eH:
    MsgBox em & vbNewLine & "错误号:2002" & vbNewLine & "错误描述:" & Err.Description

End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
On Error GoTo eH
    Select Case Button.Caption
        Case "加入"
            cButton (False)
            Set DG.DataSource = Nothing
            ADO.Recordset.AddNew
            cText (False)
            Mode = "add"
        Case "删除"
            ADO.Recordset.Delete
            ADO.Refresh
        Case "修改"
            cButton (False)
            Set DG.DataSource = Nothing
            cText (False)
            Mode = "edit"
        Case "打印"
            DE.rsPerson.Filter = s
            drPerson.Show 1
        Case "查询"
            cButton (False)
            cText (False)
            Set Text1.DataSource = Nothing: Text1.Text = ""
            Set Text2.DataSource = Nothing: Text2.Text = ""
            Set Text4.DataSource = Nothing: Text4.Text = ""
            Set Text6.DataSource = Nothing: Text6.Text = ""
            Set Text7.DataSource = Nothing: Text7.Text = ""
            Set Combo1.DataSource = Nothing: Combo1.Text = ""
            Set Combo2.DataSource = Nothing: Combo2.Text = ""
            Mode = "find"
        Case "确定"
            If Mode <> "find" Then
                ADO.Recordset.Update
                Set DG.DataSource = ADO
                MsgBox "操作成功!", vbInformation + vbOKOnly
                ADO.Refresh
    
                cButton (True)
                cText (True)
            Else
                g_SQL = ""
                If Text1.Text <> "" Then g_SQL = g_SQL + "人员姓名='" & Text1.Text & "' and "
                If Text2.Text <> "" Then g_SQL = g_SQL + "出身年月='" & Text2.Text & "' and "
                If Text4.Text <> "" Then g_SQL = g_SQL + "身份证号='" & Text4.Text & "' and "
                If Text6.Text <> "" Then g_SQL = g_SQL + "联系电话='" & Text6.Text & "' and "
                If Text7.Text <> "" Then g_SQL = g_SQL + "家庭住址='" & Text7.Text & "' and "
                If Combo1.Text <> "" Then g_SQL = g_SQL + "性别='" & Combo1.Text & "' and "
                If Combo2.Text <> "" Then g_SQL = g_SQL + "民族='" & Combo2.Text & "' and "
                If g_SQL = "" Then Exit Sub
                g_SQL = Mid(g_SQL, 1, Len(g_SQL) - 4)
                s = g_SQL
                ADO.RecordSource = "select * from 工作人员 where " & g_SQL
                ADO.Refresh
                Set Text1.DataSource = ADO
                Set Text2.DataSource = ADO
                Set Text4.DataSource = ADO
                Set Text6.DataSource = ADO
                Set Text7.DataSource = ADO
                Set Combo1.DataSource = ADO
                Set Combo2.DataSource = ADO
                
                cButton (True)
                cText (True)
            End If
        Case "取消"
            If Mode <> "find" Then
                ADO.Recordset.CancelUpdate
                Set DG.DataSource = ADO
                cButton (True)
                cText (True)
            Else
                Set Text1.DataSource = ADO
                Set Text2.DataSource = ADO
                Set Text4.DataSource = ADO
                Set Text6.DataSource = ADO
                Set Text7.DataSource = ADO
                Set Combo1.DataSource = ADO
                Set Combo2.DataSource = ADO
                cButton (True)
                cText (True)
            End If
        Case "退出"
            Unload Me
    End Select
Exit Sub
eH:
    MsgBox em & vbNewLine & "错误号:2003" & vbNewLine & "错误描述:" & Err.Description

End Sub

Private Sub cButton(b As Boolean)
    Toolbar1.Buttons(2).Enabled = b
    Toolbar1.Buttons(3).Enabled = b
    Toolbar1.Buttons(4).Enabled = b
    Toolbar1.Buttons(5).Enabled = b
    Toolbar1.Buttons(6).Enabled = b
    Toolbar1.Buttons(8).Enabled = b
    Toolbar1.Buttons(10).Visible = Not b
    Toolbar1.Buttons(11).Visible = Not b
End Sub

Private Sub cText(b As Boolean)
Dim i As Long
    If Not b Then i = vbWhite Else i = &HE0E0E0
    Text1.Locked = b: Text1.BackColor = i
    Text2.Locked = b: Text2.BackColor = i
    Text4.Locked = b: Text4.BackColor = i
    Text6.Locked = b: Text6.BackColor = i
    Text7.Locked = b: Text7.BackColor = i
    Combo1.Locked = b: Combo1.BackColor = i
    Combo2.Locked = b: Combo2.BackColor = i
End Sub


⌨️ 快捷键说明

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