form6.frm

来自「一个vb工资管理系统」· FRM 代码 · 共 557 行 · 第 1/2 页

FRM
557 行
字号
         TabIndex        =   8
         Top             =   1560
         Width           =   3015
      End
      Begin VB.CommandButton Command1 
         Caption         =   "首              页"
         Height          =   375
         Left            =   120
         TabIndex        =   7
         Top             =   1200
         Width           =   3015
      End
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   1200
         TabIndex        =   6
         Text            =   "Text2"
         Top             =   720
         Width           =   1935
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   1200
         TabIndex        =   5
         Text            =   "Text1"
         Top             =   240
         Width           =   1935
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "部门名称:"
         Height          =   180
         Left            =   120
         TabIndex        =   4
         Top             =   840
         Width           =   900
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "部门编号:"
         Height          =   180
         Left            =   120
         TabIndex        =   3
         Top             =   360
         Width           =   900
      End
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "工资管理系统部门管理"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   18
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   345
      Left            =   3840
      TabIndex        =   0
      Top             =   0
      Width           =   3750
   End
End
Attribute VB_Name = "Form6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim bb As Integer
Private Sub Command1_Click()
  Adodc1.Recordset.MoveFirst
  Call disp3
End Sub

Private Sub Command10_Click()
Text1.Text = ""
Text2.Text = ""
Text1.Locked = True
Text2.Locked = False
Call disp3
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
Command8.Enabled = True
Command9.Enabled = False
End Sub

Private Sub Command11_Click()
   Adodc1.Refresh
   Adodc1.Recordset.Find ("bmmc=" + "'" + Combo1.Text + "'")
   bh1 = Adodc1.Recordset.Fields(0)
   Data1.Refresh
   While Data1.Recordset.EOF = False
     If Trim(Mid(Data1.Recordset.Fields(0), 1, 2)) = Trim(Text1.Text) Then
        bh2 = Trim(Mid(Data1.Recordset.Fields(0), 3, 2))
        bh2 = bh1 + bh2
        Data1.Recordset.Edit
        Data1.Recordset.Fields(0) = bh2
        Data1.Recordset.Update
     End If
     Data1.Recordset.MoveNext
  Wend
  Adodc1.Refresh
  Adodc1.Recordset.Find ("bmbh=" + "'" + Text1.Text + "'")
  Adodc1.Recordset.Delete
  Frame3.Visible = False
  DataGrid1.Refresh
  Call disp3
End Sub

Private Sub Command2_Click()
   If Adodc1.Recordset.BOF = False Then
      Adodc1.Recordset.MovePrevious
   End If
   If Adodc1.Recordset.BOF = True Then
      Adodc1.Recordset.MoveNext
   End If
   Call disp3
   
End Sub

Private Sub Command3_Click()
  If Adodc1.Recordset.EOF = False Then
     Adodc1.Recordset.MoveNext
  End If
  If Adodc1.Recordset.EOF = True Then
     Adodc1.Recordset.MovePrevious
  End If
  Call disp3
End Sub

Private Sub Command4_Click()
  Adodc1.Recordset.MoveLast
  Call disp3
End Sub

Private Sub Command5_Click()
  Text1.Locked = False
  Text2.Locked = False
  Text1.Text = ""
  Text2.Text = ""
  Text1.SetFocus
  Command1.Enabled = False
  Command2.Enabled = False
  Command3.Enabled = False
  Command4.Enabled = False
  Command5.Enabled = False
  Command6.Enabled = False
  Command7.Enabled = False
  Command8.Enabled = False
  Command9.Enabled = True
  bb = 111
End Sub

Private Sub Command6_Click()
   Data1.DatabaseName = App.Path + "\gzglxt.mdb"
   Data1.RecordSource = "gzb"
   Data1.Refresh
   rs = 0
   While Data1.Recordset.EOF = False
      If Trim(Mid(Data1.Recordset.Fields(0), 1, 2)) = Trim(Text1.Text) Then
         rs = rs + 1
      End If
      Data1.Recordset.MoveNext
   Wend
   If rs > 0 Then
      '当部门中有职工时的处理
      Frame3.Visible = True
      Combo1.Text = "请选择..."
      Combo1.Enabled = False
   Else
     Adodc1.Recordset.Delete
     'Adodc1.Refresh
     MsgBox "此部门已经成功撤消"
     DataGrid1.Refresh
   End If
End Sub

Private Sub Command7_Click()
  Text2.Locked = False
  Text2.SetFocus
  Text2.SelStart = Len(Text2.Text)
  Command1.Enabled = False
  Command2.Enabled = False
  Command3.Enabled = False
  Command4.Enabled = False
  Command5.Enabled = False
  Command6.Enabled = False
  Command7.Enabled = False
  Command8.Enabled = False
  Command9.Enabled = True
  bb = 222
End Sub

Private Sub Command8_Click()
yy = InputBox("请输入您要查找的部门的名称")
Adodc1.Recordset.Find ("bmmc=" + "'" + yy + "'")
If Adodc1.Recordset.EOF = True Then
   MsgBox "查无此部门"
Else
   Call disp3
End If
End Sub

Private Sub Command9_Click()
 If bb = 111 Then
    Adodc1.Recordset.AddNew
    Adodc1.Recordset.Fields(1) = Text2.Text
    Adodc1.Recordset.Update
    DataGrid1.Refresh
 End If
 If bb = 222 Then
    Adodc1.Recordset.Fields(0) = Text1.Text
    Adodc1.Recordset.Fields(1) = Text2.Text
    Adodc1.Recordset.Update
    DataGrid1.Refresh
 End If
 Command1.Enabled = True
 Command2.Enabled = True
 Command3.Enabled = True
 Command4.Enabled = True
 Command5.Enabled = True
 Command6.Enabled = True
 Command7.Enabled = True
 Command8.Enabled = True
 Command9.Enabled = False
End Sub

Private Sub DataGrid1_Click()
   Call disp3
End Sub

Private Sub Form_Activate()
  Call disp3
  Text1.Locked = True
  Text2.Locked = True
  Command1.SetFocus
End Sub
Sub disp3()
   Text1.Text = Adodc1.Recordset.Fields(0)
   Text2.Text = Adodc1.Recordset.Fields(1)
End Sub

Private Sub Form_Load()
  Me.Top = 0
  Me.Left = 0
  Me.Height = gzglxt.Height - gzglxt.sb1.Height - 750 - gzglxt.Toolbar1.Height
  Me.Width = gzglxt.Width - 180
  Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" + App.Path + "/gzglxt.mdb"
  Adodc1.RecordSource = "bmk"
  Adodc1.Refresh
End Sub

Private Sub Option1_Click()
   If Option1.Value = True Then Combo1.Enabled = False
End Sub

Private Sub Option2_Click()
   If Option2.Value = True Then
      Combo1.Enabled = True
      Adodc1.Refresh
      Combo1.Clear
      While Adodc1.Recordset.EOF = False
         Combo1.AddItem Adodc1.Recordset.Fields(1)
         Adodc1.Recordset.MoveNext
      Wend
      Combo1.Text = "请选择..."
   End If
End Sub

⌨️ 快捷键说明

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