main_jbzl_khlx.frm
上传用户:wd52qq
上传日期:2022-07-24
资源大小:5366k
文件大小:14k
源码类别:

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
  4. Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
  5. Begin VB.Form main_jbzl_khlx 
  6.    BorderStyle     =   3  'Fixed Dialog
  7.    Caption         =   "Form1"
  8.    ClientHeight    =   3945
  9.    ClientLeft      =   45
  10.    ClientTop       =   330
  11.    ClientWidth     =   8205
  12.    Icon            =   "main_jbzl_khlx.frx":0000
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   3945
  17.    ScaleWidth      =   8205
  18.    ShowInTaskbar   =   0   'False
  19.    StartUpPosition =   2  '屏幕中心
  20.    Begin MSAdodcLib.Adodc Adodc1 
  21.       Height          =   330
  22.       Left            =   15
  23.       Top             =   3120
  24.       Visible         =   0   'False
  25.       Width           =   2040
  26.       _ExtentX        =   3598
  27.       _ExtentY        =   582
  28.       ConnectMode     =   0
  29.       CursorLocation  =   3
  30.       IsolationLevel  =   -1
  31.       ConnectionTimeout=   15
  32.       CommandTimeout  =   30
  33.       CursorType      =   3
  34.       LockType        =   3
  35.       CommandType     =   2
  36.       CursorOptions   =   0
  37.       CacheSize       =   50
  38.       MaxRecords      =   0
  39.       BOFAction       =   0
  40.       EOFAction       =   0
  41.       ConnectStringType=   1
  42.       Appearance      =   1
  43.       BackColor       =   -2147483643
  44.       ForeColor       =   -2147483640
  45.       Orientation     =   0
  46.       Enabled         =   -1
  47.       Connect         =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_manpowerinfo"
  48.       OLEDBString     =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_manpowerinfo"
  49.       OLEDBFile       =   ""
  50.       DataSourceName  =   ""
  51.       OtherAttributes =   ""
  52.       UserName        =   ""
  53.       Password        =   ""
  54.       RecordSource    =   "考核项目表"
  55.       Caption         =   "Adodc1"
  56.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  57.          Name            =   "宋体"
  58.          Size            =   9
  59.          Charset         =   134
  60.          Weight          =   400
  61.          Underline       =   0   'False
  62.          Italic          =   0   'False
  63.          Strikethrough   =   0   'False
  64.       EndProperty
  65.       _Version        =   393216
  66.    End
  67.    Begin MSDataGridLib.DataGrid DataGrid1 
  68.       Bindings        =   "main_jbzl_khlx.frx":000C
  69.       Height          =   2505
  70.       Left            =   15
  71.       TabIndex        =   4
  72.       Top             =   1410
  73.       Width           =   8160
  74.       _ExtentX        =   14393
  75.       _ExtentY        =   4419
  76.       _Version        =   393216
  77.       AllowUpdate     =   0   'False
  78.       HeadLines       =   1
  79.       RowHeight       =   15
  80.       FormatLocked    =   -1  'True
  81.       BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  82.          Name            =   "宋体"
  83.          Size            =   9
  84.          Charset         =   134
  85.          Weight          =   400
  86.          Underline       =   0   'False
  87.          Italic          =   0   'False
  88.          Strikethrough   =   0   'False
  89.       EndProperty
  90.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  91.          Name            =   "宋体"
  92.          Size            =   9
  93.          Charset         =   134
  94.          Weight          =   400
  95.          Underline       =   0   'False
  96.          Italic          =   0   'False
  97.          Strikethrough   =   0   'False
  98.       EndProperty
  99.       ColumnCount     =   2
  100.       BeginProperty Column00 
  101.          DataField       =   "编号"
  102.          Caption         =   "编号"
  103.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  104.             Type            =   0
  105.             Format          =   ""
  106.             HaveTrueFalseNull=   0
  107.             FirstDayOfWeek  =   0
  108.             FirstWeekOfYear =   0
  109.             LCID            =   2052
  110.             SubFormatType   =   0
  111.          EndProperty
  112.       EndProperty
  113.       BeginProperty Column01 
  114.          DataField       =   "考核项目"
  115.          Caption         =   "考核项目"
  116.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  117.             Type            =   0
  118.             Format          =   ""
  119.             HaveTrueFalseNull=   0
  120.             FirstDayOfWeek  =   0
  121.             FirstWeekOfYear =   0
  122.             LCID            =   2052
  123.             SubFormatType   =   0
  124.          EndProperty
  125.       EndProperty
  126.       SplitCount      =   1
  127.       BeginProperty Split0 
  128.          MarqueeStyle    =   4
  129.          BeginProperty Column00 
  130.             ColumnWidth     =   2115.213
  131.          EndProperty
  132.          BeginProperty Column01 
  133.             ColumnWidth     =   5339.906
  134.          EndProperty
  135.       EndProperty
  136.    End
  137.    Begin MSComctlLib.ImageList ImageList1 
  138.       Left            =   0
  139.       Top             =   2550
  140.       _ExtentX        =   1005
  141.       _ExtentY        =   1005
  142.       BackColor       =   -2147483643
  143.       ImageWidth      =   32
  144.       ImageHeight     =   32
  145.       MaskColor       =   12632256
  146.       _Version        =   393216
  147.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  148.          NumListImages   =   8
  149.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  150.             Picture         =   "main_jbzl_khlx.frx":0021
  151.             Key             =   ""
  152.          EndProperty
  153.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  154.             Picture         =   "main_jbzl_khlx.frx":08FB
  155.             Key             =   ""
  156.          EndProperty
  157.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  158.             Picture         =   "main_jbzl_khlx.frx":11D5
  159.             Key             =   ""
  160.          EndProperty
  161.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  162.             Picture         =   "main_jbzl_khlx.frx":1AAF
  163.             Key             =   ""
  164.          EndProperty
  165.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  166.             Picture         =   "main_jbzl_khlx.frx":2789
  167.             Key             =   ""
  168.          EndProperty
  169.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  170.             Picture         =   "main_jbzl_khlx.frx":3063
  171.             Key             =   ""
  172.          EndProperty
  173.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  174.             Picture         =   "main_jbzl_khlx.frx":37DD
  175.             Key             =   ""
  176.          EndProperty
  177.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  178.             Picture         =   "main_jbzl_khlx.frx":44B7
  179.             Key             =   ""
  180.          EndProperty
  181.       EndProperty
  182.    End
  183.    Begin MSComctlLib.Toolbar Toolbar1 
  184.       Align           =   1  'Align Top
  185.       Height          =   795
  186.       Left            =   0
  187.       TabIndex        =   6
  188.       Top             =   0
  189.       Width           =   8205
  190.       _ExtentX        =   14473
  191.       _ExtentY        =   1402
  192.       ButtonWidth     =   1138
  193.       ButtonHeight    =   1349
  194.       Appearance      =   1
  195.       Style           =   1
  196.       ImageList       =   "ImageList1"
  197.       _Version        =   393216
  198.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  199.          NumButtons      =   11
  200.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  201.             Caption         =   " 增加 "
  202.             Key             =   "add"
  203.             ImageIndex      =   1
  204.          EndProperty
  205.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  206.             Caption         =   "修改"
  207.             Key             =   "modify"
  208.             ImageIndex      =   2
  209.          EndProperty
  210.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  211.             Caption         =   "删除"
  212.             Key             =   "delete"
  213.             ImageIndex      =   3
  214.          EndProperty
  215.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  216.             Style           =   3
  217.          EndProperty
  218.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  219.             Caption         =   "保存"
  220.             Key             =   "save"
  221.             ImageIndex      =   4
  222.          EndProperty
  223.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  224.             Caption         =   "取消"
  225.             Key             =   "cancel"
  226.             ImageIndex      =   5
  227.          EndProperty
  228.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  229.             Style           =   3
  230.          EndProperty
  231.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  232.             Caption         =   "查找"
  233.             Key             =   "find"
  234.             ImageIndex      =   6
  235.          EndProperty
  236.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  237.             Caption         =   "全部"
  238.             Key             =   "all"
  239.             ImageIndex      =   7
  240.          EndProperty
  241.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  242.             Style           =   3
  243.          EndProperty
  244.          BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  245.             Caption         =   "关闭"
  246.             Key             =   "close"
  247.             ImageIndex      =   8
  248.          EndProperty
  249.       EndProperty
  250.       BorderStyle     =   1
  251.    End
  252.    Begin VB.Frame Frame1 
  253.       Height          =   585
  254.       Left            =   15
  255.       TabIndex        =   0
  256.       Top             =   810
  257.       Width           =   8175
  258.       Begin VB.TextBox Text1 
  259.          Height          =   330
  260.          Index           =   1
  261.          Left            =   3120
  262.          Locked          =   -1  'True
  263.          TabIndex        =   3
  264.          Top             =   165
  265.          Width           =   4815
  266.       End
  267.       Begin VB.TextBox Text1 
  268.          Height          =   330
  269.          Index           =   0
  270.          Left            =   735
  271.          Locked          =   -1  'True
  272.          TabIndex        =   2
  273.          Top             =   165
  274.          Width           =   1530
  275.       End
  276.       Begin VB.Label Label2 
  277.          Caption         =   "考核项目"
  278.          ForeColor       =   &H000000FF&
  279.          Height          =   165
  280.          Left            =   2340
  281.          TabIndex        =   5
  282.          Top             =   225
  283.          Width           =   975
  284.       End
  285.       Begin VB.Label Label1 
  286.          Caption         =   "编号"
  287.          ForeColor       =   &H000000FF&
  288.          Height          =   165
  289.          Left            =   180
  290.          TabIndex        =   1
  291.          Top             =   240
  292.          Width           =   435
  293.       End
  294.    End
  295. End
  296. Attribute VB_Name = "main_jbzl_khlx"
  297. Attribute VB_GlobalNameSpace = False
  298. Attribute VB_Creatable = False
  299. Attribute VB_PredeclaredId = True
  300. Attribute VB_Exposed = False
  301. Dim rs1 As New ADODB.Recordset
  302. Public blnAdd As Boolean
  303. Dim mybookmark
  304. Sub view_data()
  305.   Dim sdate, edate
  306.   Dim i As Integer
  307.   If Adodc1.Recordset.RecordCount > 0 Then
  308.   For i = 0 To 1
  309.     Text1(i) = DataGrid1.Columns(i).text
  310.   Next i
  311.   End If
  312. End Sub
  313. Sub tlbState(state As Boolean)
  314.   With Toolbar1
  315.     If state = True Then
  316.        .Buttons(1).Enabled = False
  317.        .Buttons(2).Enabled = False
  318.        .Buttons(3).Enabled = False
  319.        .Buttons(5).Enabled = True
  320.        .Buttons(6).Enabled = True
  321.        For i = 1 To Text1.UBound
  322.          Text1(i).Locked = False
  323.        Next i
  324.     Else
  325.        .Buttons(1).Enabled = True
  326.        .Buttons(2).Enabled = True
  327.        .Buttons(3).Enabled = True
  328.        .Buttons(5).Enabled = False
  329.        .Buttons(6).Enabled = False
  330.        For i = 1 To Text1.UBound
  331.          Text1(i).Locked = True
  332.        Next i
  333.      End If
  334.    End With
  335. End Sub
  336. Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
  337.   view_data
  338. End Sub
  339. Private Sub Form_Activate()
  340.   If sql <> "" Then
  341.      Adodc1.RecordSource = sql
  342.      Adodc1.Refresh
  343.      If Adodc1.Recordset.RecordCount > 0 Then
  344.         view_data
  345.      Else
  346.         MsgBox "没有找到符合条件的记录!", , "提示窗口"
  347.      End If
  348.   End If
  349. End Sub
  350. Private Sub Form_Load()
  351.   Me.Caption = text
  352.   tlbState False
  353. End Sub
  354. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  355.   sql = ""
  356. End Sub
  357. Private Sub Text1_GotFocus(Index As Integer)
  358.   Text1(Index).BackColor = &HFFFF00
  359.   Text1(Index).SelStart = 0
  360.   Text1(Index).SelLength = Len(Text1(Index))
  361. End Sub
  362. Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
  363.   If KeyCode = vbKeyReturn And Index < 1 Then Text1(Index + 1).SetFocus
  364. End Sub
  365. Private Sub Text1_LostFocus(Index As Integer)
  366.   Text1(Index).BackColor = &H80000005
  367. End Sub
  368. Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
  369.   Select Case Button.Key
  370.      Case "add"
  371.        blnAdd = True
  372.        tlbState True
  373.        rs1.Open "select * from 考核项目表", Cnn, adOpenStatic
  374.        If rs1.RecordCount > 0 Then
  375.           rs1.MoveLast
  376.           Text1(0) = Format(Val(rs1.Fields("编号")) + 1, "00")
  377.        Else
  378.           Text1(0) = "01"
  379.        End If
  380.        rs1.Close
  381.        For i = 1 To Text1.UBound
  382.            Text1(i) = ""
  383.        Next i
  384.        Text1(1).SetFocus
  385.      Case "modify"
  386.        If Adodc1.Recordset.RecordCount > 0 Then
  387.          blnAdd = False
  388.          tlbState True
  389.          view_data
  390.          mybookmark = DataGrid1.Bookmark
  391.        Else
  392.          MsgBox "系统没有要修改的数据!", , "提示窗口"
  393.        End If
  394.      Case "delete"
  395.        If Adodc1.Recordset.RecordCount > 0 Then
  396.          Adodc1.Recordset.Delete
  397.          Adodc1.Refresh
  398.        Else
  399.          MsgBox "系统没有要删除的数据!", , "提示窗口"
  400.        End If
  401.      Case "save"
  402.        On Error GoTo SaveErr
  403.         If blnAdd = True Then
  404.           Cnn.Execute ("insert into 考核项目表(编号,考核项目) values('" + Text1(0) + "','" + Text1(1) + "')")
  405.           Adodc1.Refresh
  406.           tlbState False
  407.         Else
  408.           Cnn.Execute ("update 考核项目表 set 考核项目 ='" + Text1(1) + "'where 编号='" + Text1(0) + "'")
  409.           Adodc1.Refresh
  410.           DataGrid1.Bookmark = mybookmark
  411.           view_data
  412.           tlbState False
  413.         End If
  414.         Exit Sub
  415. SaveErr:
  416.         MsgBox Err.Description
  417.      Case "cancel"
  418.        tlbState False
  419.      Case "find"
  420.        tb = "考核项目表"
  421.        Load main_find
  422.        main_find.Show 1
  423.      Case "all"
  424.        Adodc1.RecordSource = "考核项目表 order by 编号"
  425.        Adodc1.Refresh
  426.      Case "close"
  427.        Unload Me
  428.   End Select
  429. End Sub