home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Payroll_Sy2053663132007.psc / DILG / Employee.frm < prev    next >
Text File  |  2007-03-14  |  17KB  |  561 lines

  1. VERSION 5.00
  2. Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
  3. Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
  4. Begin VB.Form Employee 
  5.    BackColor       =   &H80000009&
  6.    BorderStyle     =   1  'Fixed Single
  7.    Caption         =   "Employees Record"
  8.    ClientHeight    =   8025
  9.    ClientLeft      =   45
  10.    ClientTop       =   330
  11.    ClientWidth     =   9750
  12.    Icon            =   "Employee.frx":0000
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    Moveable        =   0   'False
  17.    ScaleHeight     =   8025
  18.    ScaleWidth      =   9750
  19.    StartUpPosition =   2  'CenterScreen
  20.    Begin VB.TextBox gender 
  21.       DataField       =   "gender"
  22.       DataSource      =   "Adodc1"
  23.       Height          =   285
  24.       Left            =   9720
  25.       TabIndex        =   24
  26.       Top             =   120
  27.       Visible         =   0   'False
  28.       Width           =   975
  29.    End
  30.    Begin MSAdodcLib.Adodc Adodc1 
  31.       Height          =   330
  32.       Left            =   120
  33.       Top             =   3480
  34.       Width           =   2775
  35.       _ExtentX        =   4895
  36.       _ExtentY        =   582
  37.       ConnectMode     =   0
  38.       CursorLocation  =   3
  39.       IsolationLevel  =   -1
  40.       ConnectionTimeout=   15
  41.       CommandTimeout  =   30
  42.       CursorType      =   3
  43.       LockType        =   3
  44.       CommandType     =   2
  45.       CursorOptions   =   0
  46.       CacheSize       =   50
  47.       MaxRecords      =   0
  48.       BOFAction       =   0
  49.       EOFAction       =   0
  50.       ConnectStringType=   1
  51.       Appearance      =   1
  52.       BackColor       =   -2147483643
  53.       ForeColor       =   -2147483640
  54.       Orientation     =   0
  55.       Enabled         =   -1
  56.       Connect         =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DILG\Employee.mdb;Persist Security Info=False"
  57.       OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DILG\Employee.mdb;Persist Security Info=False"
  58.       OLEDBFile       =   ""
  59.       DataSourceName  =   ""
  60.       OtherAttributes =   ""
  61.       UserName        =   ""
  62.       Password        =   ""
  63.       RecordSource    =   "Record"
  64.       Caption         =   "Employee's Record"
  65.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  66.          Name            =   "MS Sans Serif"
  67.          Size            =   8.25
  68.          Charset         =   0
  69.          Weight          =   400
  70.          Underline       =   0   'False
  71.          Italic          =   0   'False
  72.          Strikethrough   =   0   'False
  73.       EndProperty
  74.       _Version        =   393216
  75.    End
  76.    Begin VB.Frame Frame1 
  77.       BackColor       =   &H80000009&
  78.       Caption         =   "Employee Add / Update Record"
  79.       ForeColor       =   &H80000007&
  80.       Height          =   3855
  81.       Left            =   210
  82.       TabIndex        =   6
  83.       Top             =   4035
  84.       Width           =   6375
  85.       Begin VB.TextBox Text7 
  86.          DataField       =   "contact"
  87.          DataSource      =   "Adodc1"
  88.          Enabled         =   0   'False
  89.          Height          =   285
  90.          Left            =   1200
  91.          TabIndex        =   22
  92.          Top             =   3360
  93.          Width           =   3135
  94.       End
  95.       Begin VB.TextBox Text6 
  96.          DataField       =   "address"
  97.          DataSource      =   "Adodc1"
  98.          Enabled         =   0   'False
  99.          Height          =   645
  100.          Left            =   1200
  101.          MultiLine       =   -1  'True
  102.          TabIndex        =   20
  103.          Top             =   2520
  104.          Width           =   3135
  105.       End
  106.       Begin VB.OptionButton Option2 
  107.          BackColor       =   &H8000000E&
  108.          Caption         =   "Female"
  109.          Enabled         =   0   'False
  110.          ForeColor       =   &H80000007&
  111.          Height          =   195
  112.          Left            =   1320
  113.          TabIndex        =   19
  114.          Top             =   2220
  115.          Width           =   1335
  116.       End
  117.       Begin VB.OptionButton Option1 
  118.          BackColor       =   &H8000000E&
  119.          Caption         =   "Male"
  120.          Enabled         =   0   'False
  121.          ForeColor       =   &H80000007&
  122.          Height          =   195
  123.          Left            =   285
  124.          TabIndex        =   18
  125.          Top             =   2220
  126.          Width           =   1095
  127.       End
  128.       Begin VB.TextBox Text5 
  129.          DataField       =   "position"
  130.          DataSource      =   "Adodc1"
  131.          Enabled         =   0   'False
  132.          Height          =   285
  133.          Left            =   1320
  134.          TabIndex        =   17
  135.          Top             =   1800
  136.          Width           =   2535
  137.       End
  138.       Begin VB.TextBox Text4 
  139.          DataField       =   "dob"
  140.          DataSource      =   "Adodc1"
  141.          Enabled         =   0   'False
  142.          Height          =   285
  143.          Left            =   1320
  144.          TabIndex        =   16
  145.          Top             =   1440
  146.          Width           =   2535
  147.       End
  148.       Begin VB.TextBox Text3 
  149.          DataField       =   "firstname"
  150.          DataSource      =   "Adodc1"
  151.          Enabled         =   0   'False
  152.          Height          =   285
  153.          Left            =   1320
  154.          TabIndex        =   13
  155.          Top             =   1080
  156.          Width           =   3015
  157.       End
  158.       Begin VB.TextBox Text2 
  159.          DataField       =   "lastname"
  160.          DataSource      =   "Adodc1"
  161.          Enabled         =   0   'False
  162.          Height          =   285
  163.          Left            =   1320
  164.          TabIndex        =   12
  165.          Top             =   720
  166.          Width           =   3015
  167.       End
  168.       Begin VB.TextBox Text1 
  169.          DataField       =   "id"
  170.          DataSource      =   "Adodc1"
  171.          Height          =   285
  172.          Left            =   1320
  173.          Locked          =   -1  'True
  174.          TabIndex        =   1
  175.          Top             =   345
  176.          Width           =   1215
  177.       End
  178.       Begin VB.CommandButton Command6 
  179.          Caption         =   "C&ancel"
  180.          Enabled         =   0   'False
  181.          Height          =   375
  182.          Left            =   4680
  183.          TabIndex        =   8
  184.          TabStop         =   0   'False
  185.          Top             =   720
  186.          Width           =   1455
  187.       End
  188.       Begin VB.CommandButton cmdS 
  189.          Caption         =   "&Save"
  190.          Enabled         =   0   'False
  191.          Height          =   375
  192.          Left            =   4680
  193.          TabIndex        =   7
  194.          TabStop         =   0   'False
  195.          Top             =   240
  196.          Width           =   1455
  197.       End
  198.       Begin VB.Label Label9 
  199.          AutoSize        =   -1  'True
  200.          BackColor       =   &H8000000E&
  201.          Caption         =   "CONTACT"
  202.          ForeColor       =   &H80000007&
  203.          Height          =   195
  204.          Left            =   240
  205.          TabIndex        =   23
  206.          Top             =   3360
  207.          Width           =   765
  208.       End
  209.       Begin VB.Label Label8 
  210.          AutoSize        =   -1  'True
  211.          BackColor       =   &H8000000E&
  212.          Caption         =   "ADDRESS"
  213.          ForeColor       =   &H80000007&
  214.          Height          =   195
  215.          Left            =   240
  216.          TabIndex        =   21
  217.          Top             =   2520
  218.          Width           =   780
  219.       End
  220.       Begin VB.Label Label5 
  221.          AutoSize        =   -1  'True
  222.          BackColor       =   &H8000000E&
  223.          Caption         =   "Position"
  224.          ForeColor       =   &H80000007&
  225.          Height          =   195
  226.          Left            =   240
  227.          TabIndex        =   15
  228.          Top             =   1800
  229.          Width           =   555
  230.       End
  231.       Begin VB.Label Label4 
  232.          AutoSize        =   -1  'True
  233.          BackColor       =   &H8000000E&
  234.          Caption         =   "Date of Birth"
  235.          ForeColor       =   &H80000007&
  236.          Height          =   195
  237.          Left            =   240
  238.          TabIndex        =   14
  239.          Top             =   1440
  240.          Width           =   885
  241.       End
  242.       Begin VB.Label Label3 
  243.          AutoSize        =   -1  'True
  244.          BackColor       =   &H8000000E&
  245.          Caption         =   "FIRST NAME"
  246.          ForeColor       =   &H80000007&
  247.          Height          =   195
  248.          Left            =   240
  249.          TabIndex        =   11
  250.          Top             =   1080
  251.          Width           =   975
  252.       End
  253.       Begin VB.Label Label2 
  254.          AutoSize        =   -1  'True
  255.          BackColor       =   &H8000000E&
  256.          Caption         =   "LAST NAME"
  257.          ForeColor       =   &H80000007&
  258.          Height          =   195
  259.          Left            =   240
  260.          TabIndex        =   10
  261.          Top             =   720
  262.          Width           =   915
  263.       End
  264.       Begin VB.Label Label1 
  265.          AutoSize        =   -1  'True
  266.          BackColor       =   &H8000000E&
  267.          Caption         =   "ID NO."
  268.          ForeColor       =   &H80000007&
  269.          Height          =   195
  270.          Left            =   240
  271.          TabIndex        =   9
  272.          Top             =   360
  273.          Width           =   495
  274.       End
  275.    End
  276.    Begin VB.CommandButton cmdX 
  277.       Caption         =   "E&XIT"
  278.       Height          =   375
  279.       Left            =   6720
  280.       TabIndex        =   5
  281.       Top             =   3480
  282.       Width           =   2895
  283.    End
  284.    Begin VB.CommandButton cmdD 
  285.       Caption         =   "&DELETE"
  286.       Height          =   375
  287.       Left            =   5520
  288.       TabIndex        =   4
  289.       Top             =   3480
  290.       Width           =   1095
  291.    End
  292.    Begin VB.CommandButton cmdU 
  293.       Caption         =   "&UPDATE"
  294.       Height          =   375
  295.       Left            =   4320
  296.       TabIndex        =   3
  297.       Top             =   3480
  298.       Width           =   1095
  299.    End
  300.    Begin VB.CommandButton Command1 
  301.       Caption         =   "&ADD"
  302.       Height          =   375
  303.       Left            =   3120
  304.       TabIndex        =   2
  305.       Top             =   3480
  306.       Width           =   1095
  307.    End
  308.    Begin MSDataGridLib.DataGrid DataGrid1 
  309.       Bindings        =   "Employee.frx":27A2
  310.       Height          =   3255
  311.       Left            =   120
  312.       TabIndex        =   0
  313.       Top             =   120
  314.       Width           =   9495
  315.       _ExtentX        =   16748
  316.       _ExtentY        =   5741
  317.       _Version        =   393216
  318.       AllowUpdate     =   0   'False
  319.       ColumnHeaders   =   -1  'True
  320.       HeadLines       =   1
  321.       RowHeight       =   15
  322.       BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  323.          Name            =   "MS Sans Serif"
  324.          Size            =   8.25
  325.          Charset         =   0
  326.          Weight          =   400
  327.          Underline       =   0   'False
  328.          Italic          =   0   'False
  329.          Strikethrough   =   0   'False
  330.       EndProperty
  331.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  332.          Name            =   "MS Sans Serif"
  333.          Size            =   8.25
  334.          Charset         =   0
  335.          Weight          =   400
  336.          Underline       =   0   'False
  337.          Italic          =   0   'False
  338.          Strikethrough   =   0   'False
  339.       EndProperty
  340.       ColumnCount     =   2
  341.       BeginProperty Column00 
  342.          DataField       =   ""
  343.          Caption         =   ""
  344.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  345.             Type            =   0
  346.             Format          =   ""
  347.             HaveTrueFalseNull=   0
  348.             FirstDayOfWeek  =   0
  349.             FirstWeekOfYear =   0
  350.             LCID            =   1033
  351.             SubFormatType   =   0
  352.          EndProperty
  353.       EndProperty
  354.       BeginProperty Column01 
  355.          DataField       =   ""
  356.          Caption         =   ""
  357.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  358.             Type            =   0
  359.             Format          =   ""
  360.             HaveTrueFalseNull=   0
  361.             FirstDayOfWeek  =   0
  362.             FirstWeekOfYear =   0
  363.             LCID            =   1033
  364.             SubFormatType   =   0
  365.          EndProperty
  366.       EndProperty
  367.       SplitCount      =   1
  368.       BeginProperty Split0 
  369.          BeginProperty Column00 
  370.          EndProperty
  371.          BeginProperty Column01 
  372.          EndProperty
  373.       EndProperty
  374.    End
  375.    Begin VB.Image Image1 
  376.       Height          =   2415
  377.       Left            =   6960
  378.       Picture         =   "Employee.frx":27B7
  379.       Stretch         =   -1  'True
  380.       Top             =   4680
  381.       Width           =   2520
  382.    End
  383. End
  384. Attribute VB_Name = "Employee"
  385. Attribute VB_GlobalNameSpace = False
  386. Attribute VB_Creatable = False
  387. Attribute VB_PredeclaredId = True
  388. Attribute VB_Exposed = False
  389. Option Explicit
  390. Dim mb
  391.  
  392.  
  393. Private Sub cmdD_Click()
  394.  
  395. Adodc1.Recordset.delete
  396. If Adodc1.Recordset.RecordCount = 0 Then
  397. cmdD.Enabled = False
  398. Else
  399. cmdD.Enabled = True
  400. End If
  401. End Sub
  402.  
  403. Private Sub cmdS_Click()
  404. Option1.Value = False
  405. Option2.Value = False
  406. cmdX.Enabled = True
  407. cmdU.Enabled = True
  408. cmdD.Enabled = True
  409. Command1.Enabled = True
  410. cmdS.Enabled = True
  411. Command6.Enabled = True
  412. Text2.Enabled = False
  413. Text3.Enabled = False
  414. Text4.Enabled = False
  415. Text5.Enabled = False
  416. Text6.Enabled = False
  417. Text7.Enabled = False
  418. Option1.Enabled = False
  419. Option2.Enabled = False
  420. If Len(Text1) > 0 And Len(Text2) > 0 And Len(Text3) > 0 And Len(Text4) > 0 And Len(Text5) > 0 And Len(Text6) > 0 And Len(Text7) > 0 Then
  421.     Adodc1.Recordset.UpdateBatch
  422.     savecancel
  423.     delete
  424. Else
  425.     mb = MsgBox("Invalid Data", vbCritical, "KSK")
  426. Text2.Enabled = True
  427. Text3.Enabled = True
  428. Text4.Enabled = True
  429. Text5.Enabled = True
  430. Text6.Enabled = True
  431. Text7.Enabled = True
  432. Option1.Enabled = True
  433. Option2.Enabled = True
  434. Option1.Value = False
  435. Option2.Value = False
  436. cmdX.Enabled = False
  437. cmdU.Enabled = False
  438. cmdD.Enabled = False
  439. Command1.Enabled = False
  440. End If
  441. End Sub
  442.  
  443. Private Sub cmdU_Click()
  444. Option1.Value = False
  445. Option2.Value = False
  446. cmdX.Enabled = False
  447. cmdU.Enabled = False
  448. cmdD.Enabled = False
  449. cmdS.Enabled = True
  450. Command6.Enabled = True
  451. Text2.Enabled = True
  452. Text3.Enabled = True
  453. Text4.Enabled = True
  454. Text5.Enabled = True
  455. Text6.Enabled = True
  456. Text7.Enabled = True
  457. Option1.Enabled = True
  458. Option2.Enabled = True
  459. addupdate
  460. End Sub
  461.  
  462. Private Sub cmdX_Click()
  463. Employee.Hide
  464. Menu.Show
  465. End Sub
  466. Private Sub Command1_Click()
  467. Option1.Value = False
  468. Option2.Value = False
  469. cmdX.Enabled = False
  470. cmdU.Enabled = False
  471. cmdD.Enabled = False
  472. Adodc1.Recordset.AddNew
  473. Text1 = "DILG" & Round(Rnd() * 99) & Chr(Round(Rnd() * 25) + 65)
  474. Text1.SetFocus
  475. cmdS.Enabled = True
  476. Command6.Enabled = True
  477. Text2.Enabled = True
  478. Text3.Enabled = True
  479. Text4.Enabled = True
  480. Text5.Enabled = True
  481. Text6.Enabled = True
  482. Text7.Enabled = True
  483. Option1.Enabled = True
  484. Option2.Enabled = True
  485. addupdate
  486. End Sub
  487.  
  488.  
  489. Private Sub Command6_Click()
  490. Unload Me
  491. Employee.Show
  492. End Sub
  493. Private Function delete()
  494. DataGrid1.Refresh
  495.  
  496. If Adodc1.Recordset.RecordCount = 0 Then
  497.     Adodc1.Enabled = False
  498.     DataGrid1.Enabled = False
  499.     
  500.     cmdD.Enabled = False
  501.     cmdU.Enabled = False
  502. Else
  503.     Adodc1.Enabled = True
  504.     DataGrid1.Enabled = True
  505.     
  506.     cmdD.Enabled = True
  507.     cmdU.Enabled = True
  508. End If
  509.  
  510. End Function
  511.  
  512. Private Sub Form_Load()
  513. Option1.Value = False
  514. Option2.Value = False
  515. If Adodc1.Recordset.RecordCount = 0 Then
  516. cmdD.Enabled = False
  517. Else
  518. cmdD.Enabled = True
  519. End If
  520. End Sub
  521.  
  522. Private Sub Form_Terminate()
  523. Main.Show
  524. End Sub
  525.  
  526. Private Sub Form_Unload(Cancel As Integer)
  527. Adodc1.Recordset.CancelBatch
  528. Main.Show
  529. End Sub
  530. Private Function savecancel()
  531. DataGrid1.Refresh
  532.  
  533. Command1.Enabled = True
  534. cmdS.Enabled = False
  535. Command6.Enabled = False
  536.  
  537. End Function
  538. Private Function addupdate()
  539. Command1.Enabled = False
  540. cmdU.Enabled = False
  541. cmdS.Enabled = True
  542. Command6.Enabled = True
  543. cmdD.Enabled = False
  544.  
  545. Adodc1.Enabled = False
  546. DataGrid1.Enabled = False
  547. End Function
  548.  
  549. Private Sub Option1_Click()
  550. If Option1.Value = True Then
  551. gender.Text = "Male"
  552. End If
  553. End Sub
  554.  
  555. Private Sub Option2_Click()
  556. If Option2.Value = True Then
  557. gender.Text = "Female"
  558. End If
  559. End Sub
  560.  
  561.