F_BuYuanShenQing.frm
上传用户:xiao_xia32
上传日期:2022-07-21
资源大小:1174k
文件大小:30k
源码类别:

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
  3. Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
  4. Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
  5. Object = "{0BA686C6-F7D3-101A-993E-0000C0EF6F5E}#1.0#0"; "THREED32.OCX"
  6. Begin VB.Form F_BuYuanShenQing 
  7.    BorderStyle     =   3  'Fixed Dialog
  8.    Caption         =   "补员申请单"
  9.    ClientHeight    =   8625
  10.    ClientLeft      =   1095
  11.    ClientTop       =   330
  12.    ClientWidth     =   11820
  13.    ControlBox      =   0   'False
  14.    KeyPreview      =   -1  'True
  15.    LinkTopic       =   "Form1"
  16.    LockControls    =   -1  'True
  17.    MaxButton       =   0   'False
  18.    MinButton       =   0   'False
  19.    Moveable        =   0   'False
  20.    ScaleHeight     =   8625
  21.    ScaleWidth      =   11820
  22.    StartUpPosition =   2  '屏幕中心
  23.    Begin VB.Frame Framex 
  24.       BeginProperty Font 
  25.          Name            =   "MS Sans Serif"
  26.          Size            =   8.25
  27.          Charset         =   0
  28.          Weight          =   400
  29.          Underline       =   0   'False
  30.          Italic          =   0   'False
  31.          Strikethrough   =   0   'False
  32.       EndProperty
  33.       Height          =   8535
  34.       Left            =   120
  35.       TabIndex        =   20
  36.       Top             =   0
  37.       Width           =   11655
  38.       Begin TabDlg.SSTab SSTab1 
  39.          Height          =   7935
  40.          Left            =   240
  41.          TabIndex        =   21
  42.          Top             =   240
  43.          Width           =   11295
  44.          _ExtentX        =   19923
  45.          _ExtentY        =   13996
  46.          _Version        =   393216
  47.          Tabs            =   2
  48.          TabHeight       =   520
  49.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  50.             Name            =   "宋体"
  51.             Size            =   9
  52.             Charset         =   134
  53.             Weight          =   400
  54.             Underline       =   0   'False
  55.             Italic          =   0   'False
  56.             Strikethrough   =   0   'False
  57.          EndProperty
  58.          TabCaption(0)   =   "编        辑"
  59.          TabPicture(0)   =   "F_BuYuanShenQing.frx":0000
  60.          Tab(0).ControlEnabled=   -1  'True
  61.          Tab(0).Control(0)=   "Frame1"
  62.          Tab(0).Control(0).Enabled=   0   'False
  63.          Tab(0).Control(1)=   "Picture1"
  64.          Tab(0).Control(1).Enabled=   0   'False
  65.          Tab(0).ControlCount=   2
  66.          TabCaption(1)   =   "列        表"
  67.          TabPicture(1)   =   "F_BuYuanShenQing.frx":001C
  68.          Tab(1).ControlEnabled=   0   'False
  69.          Tab(1).Control(0)=   "Framey"
  70.          Tab(1).ControlCount=   1
  71.          Begin VB.PictureBox Picture1 
  72.             Appearance      =   0  'Flat
  73.             BorderStyle     =   0  'None
  74.             BeginProperty Font 
  75.                Name            =   "MS Sans Serif"
  76.                Size            =   8.25
  77.                Charset         =   0
  78.                Weight          =   400
  79.                Underline       =   0   'False
  80.                Italic          =   0   'False
  81.                Strikethrough   =   0   'False
  82.             EndProperty
  83.             ForeColor       =   &H80000008&
  84.             Height          =   660
  85.             Left            =   3600
  86.             ScaleHeight     =   660
  87.             ScaleWidth      =   7080
  88.             TabIndex        =   40
  89.             Top             =   7080
  90.             Width           =   7080
  91.             Begin Threed.SSCommand cmdClose 
  92.                Height          =   330
  93.                Left            =   5640
  94.                TabIndex        =   41
  95.                Top             =   240
  96.                Width           =   1095
  97.                _Version        =   65536
  98.                _ExtentX        =   1931
  99.                _ExtentY        =   573
  100.                _StockProps     =   78
  101.                Caption         =   "&Q.关 闭"
  102.                Font3D          =   1
  103.             End
  104.             Begin Threed.SSCommand cmdRefresh 
  105.                Height          =   330
  106.                Left            =   4440
  107.                TabIndex        =   42
  108.                Top             =   240
  109.                Width           =   1095
  110.                _Version        =   65536
  111.                _ExtentX        =   1931
  112.                _ExtentY        =   573
  113.                _StockProps     =   78
  114.                Caption         =   "&R.刷 新"
  115.                Font3D          =   1
  116.             End
  117.             Begin Threed.SSCommand CmdAdd 
  118.                Height          =   330
  119.                Left            =   840
  120.                TabIndex        =   15
  121.                Top             =   240
  122.                Width           =   1095
  123.                _Version        =   65536
  124.                _ExtentX        =   1931
  125.                _ExtentY        =   582
  126.                _StockProps     =   78
  127.                Caption         =   "&A.增 加"
  128.                Font3D          =   1
  129.                Picture         =   "F_BuYuanShenQing.frx":0038
  130.             End
  131.             Begin Threed.SSCommand cmdEdit 
  132.                Height          =   330
  133.                Left            =   2040
  134.                TabIndex        =   16
  135.                Top             =   240
  136.                Width           =   1095
  137.                _Version        =   65536
  138.                _ExtentX        =   1931
  139.                _ExtentY        =   573
  140.                _StockProps     =   78
  141.                Caption         =   "&E.编 辑"
  142.                Font3D          =   1
  143.             End
  144.             Begin Threed.SSCommand CmdDelete 
  145.                Height          =   330
  146.                Left            =   3240
  147.                TabIndex        =   17
  148.                Top             =   240
  149.                Width           =   1095
  150.                _Version        =   65536
  151.                _ExtentX        =   1931
  152.                _ExtentY        =   573
  153.                _StockProps     =   78
  154.                Caption         =   "&D.删 除"
  155.                Font3D          =   1
  156.             End
  157.             Begin Threed.SSCommand cmdCancel 
  158.                Height          =   330
  159.                Left            =   5640
  160.                TabIndex        =   19
  161.                Top             =   240
  162.                Width           =   1095
  163.                _Version        =   65536
  164.                _ExtentX        =   1931
  165.                _ExtentY        =   573
  166.                _StockProps     =   78
  167.                Caption         =   "&C.取消"
  168.                Font3D          =   1
  169.             End
  170.             Begin Threed.SSCommand cmdUpdate 
  171.                Height          =   330
  172.                Left            =   4440
  173.                TabIndex        =   18
  174.                Top             =   240
  175.                Width           =   1095
  176.                _Version        =   65536
  177.                _ExtentX        =   1931
  178.                _ExtentY        =   573
  179.                _StockProps     =   78
  180.                Caption         =   "&Y.保存"
  181.                Font3D          =   1
  182.             End
  183.          End
  184.          Begin VB.Frame Framey 
  185.             BeginProperty Font 
  186.                Name            =   "MS Sans Serif"
  187.                Size            =   8.25
  188.                Charset         =   0
  189.                Weight          =   400
  190.                Underline       =   0   'False
  191.                Italic          =   0   'False
  192.                Strikethrough   =   0   'False
  193.             EndProperty
  194.             Height          =   7215
  195.             Left            =   -74760
  196.             TabIndex        =   34
  197.             Top             =   480
  198.             Width           =   10935
  199.             Begin MSDataGridLib.DataGrid DataGrid1 
  200.                Height          =   6495
  201.                Left            =   270
  202.                TabIndex        =   35
  203.                Top             =   330
  204.                Width           =   10575
  205.                _ExtentX        =   18653
  206.                _ExtentY        =   11456
  207.                _Version        =   393216
  208.                AllowUpdate     =   0   'False
  209.                HeadLines       =   1
  210.                RowHeight       =   14
  211.                BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  212.                   Name            =   "MS Sans Serif"
  213.                   Size            =   8.25
  214.                   Charset         =   0
  215.                   Weight          =   400
  216.                   Underline       =   0   'False
  217.                   Italic          =   0   'False
  218.                   Strikethrough   =   0   'False
  219.                EndProperty
  220.                BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  221.                   Name            =   "宋体"
  222.                   Size            =   9
  223.                   Charset         =   134
  224.                   Weight          =   400
  225.                   Underline       =   0   'False
  226.                   Italic          =   0   'False
  227.                   Strikethrough   =   0   'False
  228.                EndProperty
  229.                ColumnCount     =   2
  230.                BeginProperty Column00 
  231.                   DataField       =   ""
  232.                   Caption         =   ""
  233.                   BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  234.                      Type            =   0
  235.                      Format          =   ""
  236.                      HaveTrueFalseNull=   0
  237.                      FirstDayOfWeek  =   0
  238.                      FirstWeekOfYear =   0
  239.                      LCID            =   2052
  240.                      SubFormatType   =   0
  241.                   EndProperty
  242.                EndProperty
  243.                BeginProperty Column01 
  244.                   DataField       =   ""
  245.                   Caption         =   ""
  246.                   BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  247.                      Type            =   0
  248.                      Format          =   ""
  249.                      HaveTrueFalseNull=   0
  250.                      FirstDayOfWeek  =   0
  251.                      FirstWeekOfYear =   0
  252.                      LCID            =   2052
  253.                      SubFormatType   =   0
  254.                   EndProperty
  255.                EndProperty
  256.                SplitCount      =   1
  257.                BeginProperty Split0 
  258.                   BeginProperty Column00 
  259.                   EndProperty
  260.                   BeginProperty Column01 
  261.                   EndProperty
  262.                EndProperty
  263.             End
  264.          End
  265.          Begin VB.Frame Frame1 
  266.             BeginProperty Font 
  267.                Name            =   "MS Sans Serif"
  268.                Size            =   8.25
  269.                Charset         =   0
  270.                Weight          =   400
  271.                Underline       =   0   'False
  272.                Italic          =   0   'False
  273.                Strikethrough   =   0   'False
  274.             EndProperty
  275.             Height          =   6735
  276.             Left            =   240
  277.             TabIndex        =   22
  278.             Top             =   360
  279.             Width           =   10695
  280.             Begin VB.TextBox txtFields 
  281.                Appearance      =   0  'Flat
  282.                DataField       =   "工作项目说明"
  283.                Enabled         =   0   'False
  284.                Height          =   525
  285.                Index           =   9
  286.                Left            =   1800
  287.                MultiLine       =   -1  'True
  288.                ScrollBars      =   2  'Vertical
  289.                TabIndex        =   8
  290.                Top             =   3240
  291.                Width           =   8655
  292.             End
  293.             Begin VB.TextBox txtFields 
  294.                Appearance      =   0  'Flat
  295.                DataField       =   "所学专业要求"
  296.                Enabled         =   0   'False
  297.                Height          =   525
  298.                Index           =   7
  299.                Left            =   1800
  300.                MultiLine       =   -1  'True
  301.                ScrollBars      =   2  'Vertical
  302.                TabIndex        =   7
  303.                Top             =   2520
  304.                Width           =   8655
  305.             End
  306.             Begin VB.TextBox txtFields 
  307.                Appearance      =   0  'Flat
  308.                DataField       =   "学历要求"
  309.                Enabled         =   0   'False
  310.                Height          =   525
  311.                Index           =   2
  312.                Left            =   1800
  313.                MultiLine       =   -1  'True
  314.                ScrollBars      =   2  'Vertical
  315.                TabIndex        =   6
  316.                Top             =   1800
  317.                Width           =   8655
  318.             End
  319.             Begin VB.TextBox txtFields 
  320.                Appearance      =   0  'Flat
  321.                DataField       =   "年龄要求"
  322.                Enabled         =   0   'False
  323.                Height          =   285
  324.                Index           =   1
  325.                Left            =   1800
  326.                MultiLine       =   -1  'True
  327.                TabIndex        =   5
  328.                Top             =   1320
  329.                Width           =   1815
  330.             End
  331.             Begin VB.ComboBox Combo2 
  332.                Appearance      =   0  'Flat
  333.                DataField       =   "岗位编号"
  334.                BeginProperty Font 
  335.                   Name            =   "MS Sans Serif"
  336.                   Size            =   8.25
  337.                   Charset         =   0
  338.                   Weight          =   400
  339.                   Underline       =   0   'False
  340.                   Italic          =   0   'False
  341.                   Strikethrough   =   0   'False
  342.                EndProperty
  343.                Height          =   315
  344.                Left            =   8280
  345.                TabIndex        =   2
  346.                Top             =   360
  347.                Width           =   1815
  348.             End
  349.             Begin VB.ComboBox Combo1 
  350.                Appearance      =   0  'Flat
  351.                DataField       =   "部门"
  352.                Height          =   300
  353.                Left            =   1800
  354.                TabIndex        =   0
  355.                Top             =   360
  356.                Width           =   1815
  357.             End
  358.             Begin MSComCtl2.DTPicker DTPickers 
  359.                DataField       =   "签字时间"
  360.                Height          =   300
  361.                Index           =   1
  362.                Left            =   7560
  363.                TabIndex        =   13
  364.                Top             =   5160
  365.                Width           =   1815
  366.                _ExtentX        =   3201
  367.                _ExtentY        =   529
  368.                _Version        =   393216
  369.                CheckBox        =   -1  'True
  370.                DateIsNull      =   -1  'True
  371.                Format          =   64421889
  372.                CurrentDate     =   36186
  373.             End
  374.             Begin MSComCtl2.DTPicker DTPickers 
  375.                DataField       =   "预计上岗时间"
  376.                Height          =   300
  377.                Index           =   0
  378.                Left            =   7560
  379.                TabIndex        =   11
  380.                Top             =   4680
  381.                Width           =   1815
  382.                _ExtentX        =   3201
  383.                _ExtentY        =   529
  384.                _Version        =   393216
  385.                CheckBox        =   -1  'True
  386.                DateIsNull      =   -1  'True
  387.                Format          =   64421889
  388.                CurrentDate     =   36186
  389.             End
  390.             Begin VB.TextBox txtFields 
  391.                Appearance      =   0  'Flat
  392.                DataField       =   "部门经理签字"
  393.                Height          =   285
  394.                Index           =   8
  395.                Left            =   1800
  396.                TabIndex        =   12
  397.                Top             =   5175
  398.                Width           =   1815
  399.             End
  400.             Begin VB.TextBox txtFields 
  401.                Appearance      =   0  'Flat
  402.                DataField       =   "说明"
  403.                Height          =   645
  404.                Index           =   10
  405.                Left            =   1800
  406.                MultiLine       =   -1  'True
  407.                ScrollBars      =   2  'Vertical
  408.                TabIndex        =   14
  409.                Top             =   5640
  410.                Width           =   8655
  411.             End
  412.             Begin VB.TextBox txtFields 
  413.                Appearance      =   0  'Flat
  414.                DataField       =   "新增条件"
  415.                Height          =   525
  416.                Index           =   6
  417.                Left            =   1800
  418.                MultiLine       =   -1  'True
  419.                ScrollBars      =   2  'Vertical
  420.                TabIndex        =   9
  421.                Top             =   3960
  422.                Width           =   8655
  423.             End
  424.             Begin VB.TextBox txtFields 
  425.                Appearance      =   0  'Flat
  426.                DataField       =   "性别要求"
  427.                Enabled         =   0   'False
  428.                Height          =   285
  429.                Index           =   5
  430.                Left            =   5040
  431.                MultiLine       =   -1  'True
  432.                TabIndex        =   4
  433.                Top             =   840
  434.                Width           =   1815
  435.             End
  436.             Begin VB.TextBox txtFields 
  437.                Appearance      =   0  'Flat
  438.                DataField       =   "补员数量"
  439.                Height          =   285
  440.                Index           =   4
  441.                Left            =   1800
  442.                TabIndex        =   10
  443.                Top             =   4695
  444.                Width           =   1815
  445.             End
  446.             Begin VB.TextBox txtFields 
  447.                Appearance      =   0  'Flat
  448.                DataField       =   "岗位名称"
  449.                Enabled         =   0   'False
  450.                Height          =   285
  451.                Index           =   3
  452.                Left            =   1800
  453.                TabIndex        =   3
  454.                Top             =   840
  455.                Width           =   1815
  456.             End
  457.             Begin VB.TextBox txtFields 
  458.                Appearance      =   0  'Flat
  459.                DataField       =   "编号"
  460.                Height          =   285
  461.                Index           =   0
  462.                Left            =   5040
  463.                TabIndex        =   1
  464.                Top             =   360
  465.                Width           =   1815
  466.             End
  467.             Begin VB.Label lblLabels 
  468.                Caption         =   "工作项目说明"
  469.                Height          =   255
  470.                Index           =   14
  471.                Left            =   240
  472.                TabIndex        =   39
  473.                Top             =   3240
  474.                Width           =   1095
  475.             End
  476.             Begin VB.Label lblLabels 
  477.                Caption         =   "所学专业要求"
  478.                Height          =   255
  479.                Index           =   13
  480.                Left            =   240
  481.                TabIndex        =   38
  482.                Top             =   2520
  483.                Width           =   1095
  484.             End
  485.             Begin VB.Label lblLabels 
  486.                Caption         =   "学历要求"
  487.                Height          =   255
  488.                Index           =   12
  489.                Left            =   240
  490.                TabIndex        =   37
  491.                Top             =   1800
  492.                Width           =   1095
  493.             End
  494.             Begin VB.Label lblLabels 
  495.                Caption         =   "年龄要求"
  496.                Height          =   255
  497.                Index           =   11
  498.                Left            =   240
  499.                TabIndex        =   36
  500.                Top             =   1320
  501.                Width           =   1095
  502.             End
  503.             Begin VB.Label lblLabels 
  504.                Caption         =   "部门经理签字"
  505.                Height          =   255
  506.                Index           =   8
  507.                Left            =   240
  508.                TabIndex        =   33
  509.                Top             =   5190
  510.                Width           =   1095
  511.             End
  512.             Begin VB.Label lblLabels 
  513.                Caption         =   "签字时间"
  514.                Height          =   255
  515.                Index           =   9
  516.                Left            =   5640
  517.                TabIndex        =   32
  518.                Top             =   5190
  519.                Width           =   1095
  520.             End
  521.             Begin VB.Label lblLabels 
  522.                Caption         =   "说  明"
  523.                Height          =   255
  524.                Index           =   10
  525.                Left            =   240
  526.                TabIndex        =   31
  527.                Top             =   5640
  528.                Width           =   1095
  529.             End
  530.             Begin VB.Label lblLabels 
  531.                Caption         =   "新增条件"
  532.                Height          =   255
  533.                Index           =   6
  534.                Left            =   240
  535.                TabIndex        =   30
  536.                Top             =   3960
  537.                Width           =   1095
  538.             End
  539.             Begin VB.Label lblLabels 
  540.                Caption         =   "性别要求"
  541.                Height          =   255
  542.                Index           =   5
  543.                Left            =   3840
  544.                TabIndex        =   29
  545.                Top             =   960
  546.                Width           =   1095
  547.             End
  548.             Begin VB.Label lblLabels 
  549.                Caption         =   "预计上岗时间"
  550.                Height          =   255
  551.                Index           =   7
  552.                Left            =   5640
  553.                TabIndex        =   28
  554.                Top             =   4710
  555.                Width           =   1095
  556.             End
  557.             Begin VB.Label lblLabels 
  558.                Caption         =   "补员数量"
  559.                Height          =   255
  560.                Index           =   4
  561.                Left            =   240
  562.                TabIndex        =   27
  563.                Top             =   4710
  564.                Width           =   1095
  565.             End
  566.             Begin VB.Label lblLabels 
  567.                Caption         =   "岗位名称"
  568.                Height          =   255
  569.                Index           =   3
  570.                Left            =   240
  571.                TabIndex        =   26
  572.                Top             =   840
  573.                Width           =   1095
  574.             End
  575.             Begin VB.Label lblLabels 
  576.                Caption         =   "岗位编号"
  577.                BeginProperty Font 
  578.                   Name            =   "MS Sans Serif"
  579.                   Size            =   8.25
  580.                   Charset         =   0
  581.                   Weight          =   400
  582.                   Underline       =   0   'False
  583.                   Italic          =   0   'False
  584.                   Strikethrough   =   0   'False
  585.                EndProperty
  586.                Height          =   255
  587.                Index           =   2
  588.                Left            =   7200
  589.                TabIndex        =   25
  590.                Top             =   360
  591.                Width           =   1095
  592.             End
  593.             Begin VB.Label lblLabels 
  594.                Caption         =   "部  门"
  595.                Height          =   255
  596.                Index           =   1
  597.                Left            =   240
  598.                TabIndex        =   24
  599.                Top             =   360
  600.                Width           =   1095
  601.             End
  602.             Begin VB.Label lblLabels 
  603.                Caption         =   "编  号"
  604.                Height          =   255
  605.                Index           =   0
  606.                Left            =   3840
  607.                TabIndex        =   23
  608.                Top             =   360
  609.                Width           =   1095
  610.             End
  611.          End
  612.       End
  613.    End
  614. End
  615. Attribute VB_Name = "F_BuYuanShenQing"
  616. Attribute VB_GlobalNameSpace = False
  617. Attribute VB_Creatable = False
  618. Attribute VB_PredeclaredId = True
  619. Attribute VB_Exposed = False
  620. Dim WithEvents adoPrimaryRS As Recordset
  621. Attribute adoPrimaryRS.VB_VarHelpID = -1
  622. Dim mvBookMark As Variant
  623. Dim mbEditFlag As Boolean
  624. Dim mbAddNewFlag As Boolean
  625. Private Sub Combo1_Click()
  626. Dim sql2 As String
  627. Combo2.Clear
  628. sql2 = "select  distinct 岗位编号  from 岗位说明  where 所属部门 = '" & Combo1.Text & "'"
  629. Set rs2 = db.Execute(sql2)
  630.    
  631. While Not rs2.EOF
  632.    Combo2.AddItem Trim(rs2("岗位编号"))
  633.    rs2.MoveNext
  634. Wend
  635. End Sub
  636. Private Sub Combo1_KeyPress(KeyAscii As Integer)
  637. If KeyAscii = vbKeyReturn Then
  638.     SendKeys "{TAB}"
  639. End If
  640. End Sub
  641. Private Sub Combo2_Click()
  642. Dim Sql3 As String
  643. Sql3 = "select  distinct 岗位名称 ,性别要求 ,年龄要求 ,学历要求 , 所学专业要求 ,  工作项目说明 from 岗位说明  where 岗位编号 = '" & Combo2.Text & "'"
  644. Set rs3 = db.Execute(Sql3)
  645. If Not IsNull(rs3("岗位名称")) Then
  646. txtFields(3).Text = Trim(rs3("岗位名称"))
  647. End If
  648. If Not IsNull(rs3("性别要求")) Then
  649. txtFields(5).Text = Trim(rs3("性别要求"))
  650. End If
  651. If Not IsNull(rs3("年龄要求")) Then
  652. txtFields(1).Text = Trim(rs3("年龄要求"))
  653. End If
  654. If Not IsNull(rs3("学历要求")) Then
  655. txtFields(2).Text = Trim(rs3("学历要求"))
  656. End If
  657. If Not IsNull(rs3("所学专业要求")) Then
  658. txtFields(7).Text = Trim(rs3("所学专业要求"))
  659. End If
  660. If Not IsNull(rs3("工作项目说明")) Then
  661. txtFields(9).Text = Trim(rs3("工作项目说明"))
  662. End If
  663. End Sub
  664. Private Sub Combo2_KeyPress(KeyAscii As Integer)
  665.     If KeyAscii = vbKeyReturn Then
  666.         SendKeys "{TAB}"
  667.     End If
  668. End Sub
  669. Private Sub DTPickers_KeyPress(Index As Integer, KeyAscii As Integer)
  670. If KeyAscii = vbKeyReturn Then
  671.     SendKeys "{TAB}"
  672. End If
  673. End Sub
  674. Private Sub Form_Load()
  675. Dim SqlBuMen As String
  676.   Set adoPrimaryRS = New Recordset
  677.   adoPrimaryRS.Open "select * from 增员需求单", db, adOpenStatic, adLockOptimistic
  678.   
  679.   Set DataGrid1.DataSource = adoPrimaryRS
  680.   
  681.   SetButtons True
  682.   
  683.   Dim oText As TextBox
  684.   'Bind the text boxes to the data provider
  685.   For Each oText In Me.txtFields
  686.     Set oText.DataSource = adoPrimaryRS
  687.      
  688.   Next
  689.   
  690.  Set Combo1.DataSource = adoPrimaryRS
  691.  Set Combo2.DataSource = adoPrimaryRS
  692.    
  693.   Dim oDTP As DTPicker
  694.   'Bind the DTPicker to the data provider
  695.   For Each oDTP In Me.DTPickers
  696.     Set oDTP.DataSource = adoPrimaryRS
  697.   Next
  698.    
  699.   SqlBuMen = "select  distinct 部门名称 from 部门维护表"
  700.   Set RsBuMen = db.Execute(SqlBuMen)
  701.    
  702.   While Not RsBuMen.EOF
  703.      Combo1.AddItem Trim(RsBuMen("部门名称"))
  704.     RsBuMen.MoveNext
  705.   Wend
  706.   
  707.   
  708. End Sub
  709. Private Sub Form_Unload(Cancel As Integer)
  710.   Screen.MousePointer = vbDefault
  711. End Sub
  712. Private Sub cmdadd_Click()
  713.   On Error GoTo AddErr
  714.   With adoPrimaryRS
  715.     If Not (.BOF And .EOF) Then
  716.       mvBookMark = .Bookmark
  717.     End If
  718.     .AddNew
  719.     mbAddNewFlag = True
  720.     SetButtons False
  721.   End With
  722.   Exit Sub
  723. AddErr:
  724.   MsgBox "增加操作有错误", vbExclamation + vbOKOnly, pTitle
  725.   
  726. End Sub
  727. Private Sub cmddelete_Click()
  728.   On Error GoTo DeleteErr
  729.   If MsgBox("确认是否申请单?", vbYesNo + vbQuestion, "系统提示") = vbNo Then Exit Sub
  730.   With adoPrimaryRS
  731.     .Delete
  732.     .MoveNext
  733.     If .EOF Then .MoveLast
  734.   End With
  735.   Exit Sub
  736. DeleteErr:
  737.   MsgBox "删除操作有错误", vbExclamation + vbOKOnly, pTitle
  738. End Sub
  739. Private Sub cmdRefresh_Click()
  740.   'This is only needed for multi user apps
  741.   On Error GoTo RefreshErr
  742.   adoPrimaryRS.Requery
  743.   Exit Sub
  744. RefreshErr:
  745.    MsgBox "刷新操作有错误", vbExclamation + vbOKOnly, pTitle
  746. End Sub
  747. Private Sub cmdedit_Click()
  748.   On Error GoTo EditErr
  749.   mbEditFlag = True
  750.   SetButtons False
  751.   Exit Sub
  752. EditErr:
  753.    MsgBox "更改操作有错误", vbExclamation + vbOKOnly, pTitle
  754. End Sub
  755. Private Sub cmdCancel_Click()
  756.  ' On Error Resume Next
  757.  On Error GoTo CancelErr
  758.   mbEditFlag = False
  759.   mbAddNewFlag = False
  760.   adoPrimaryRS.CancelUpdate
  761.   If mvBookMark > 0 Then
  762.    adoPrimaryRS.Bookmark = mvBookMark
  763.   Else
  764.    adoPrimaryRS.MoveFirst
  765.   End If
  766.  SetButtons True
  767.   Exit Sub
  768. CancelErr:
  769.    
  770.    MsgBox "取消操作有错误", vbExclamation + vbOKOnly, pTitle
  771. End Sub
  772. Private Sub cmdUpdate_Click()
  773.   On Error GoTo UpdateErr
  774.   If MsgBox("是否确认此操作?", vbYesNo + vbQuestion, "系统提示") = vbNo Then Exit Sub
  775.   adoPrimaryRS.UpdateBatch adAffectAll
  776.   If mbAddNewFlag Then
  777.     adoPrimaryRS.MoveLast              'move to the new record
  778.   End If
  779.   mbEditFlag = False
  780.   mbAddNewFlag = False
  781.   SetButtons True
  782.   On Error GoTo 0
  783.   Exit Sub
  784. UpdateErr:
  785.    MsgBox "保存操作有错误", vbExclamation + vbOKOnly, pTitle
  786. End Sub
  787. Private Sub cmdClose_Click()
  788.  RSGL.Enabled = True
  789.  Unload Me
  790. End Sub
  791. Private Sub SetButtons(bVal As Boolean)
  792. Dim oText As TextBox
  793.   cmdAdd.Visible = bVal
  794.   cmdEdit.Visible = bVal
  795.   cmdUpdate.Visible = Not bVal
  796.   cmdCancel.Visible = Not bVal
  797.   cmdDelete.Visible = bVal
  798.   cmdClose.Visible = bVal
  799.   cmdRefresh.Visible = bVal
  800.  
  801.    Combo1.Enabled = Not bVal
  802.    Combo2.Enabled = Not bVal
  803.    txtFields(4).Enabled = Not bVal
  804.    txtFields(8).Enabled = Not bVal
  805.    txtFields(10).Enabled = Not bVal
  806.    
  807.    DTPickers(0).Enabled = Not bVal
  808.    DTPickers(1).Enabled = Not bVal
  809.    
  810.   If bVal Then
  811.    Set DataGrid1.DataSource = adoPrimaryRS
  812.   Else
  813.    Set DataGrid1.DataSource = Nothing
  814.   End If
  815. End Sub
  816. Private Sub txtFields_KeyPress(Index As Integer, KeyAscii As Integer)
  817. If KeyAscii = vbKeyReturn Then
  818.     SendKeys "{TAB}"
  819. End If
  820. End Sub
  821. Private Sub txtFields_LostFocus(Index As Integer)
  822. If Not IsNumeric(txtFields(4).Text) And (txtFields(4).Text <> "") Then
  823.     MsgBox "请在“补员数量”中输入数字", vbExclamation + vbOKOnly, pTitle
  824.      txtFields(4).SetFocus
  825.      txtFields(4).SelStart = 0
  826.      txtFields(4).SelLength = Len(txtFields(4))
  827.      
  828. End If
  829. End Sub