home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Special / chip-cd_2001_spec_05.zip / spec_05 / apps / crystal / disk18 / Xvb369._ / Xvb369.
Text File  |  1999-08-23  |  12KB  |  409 lines

  1. VERSION 5.00
  2. Begin VB.Form frmEmployee 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Employee"
  5.    ClientHeight    =   4575
  6.    ClientLeft      =   330
  7.    ClientTop       =   780
  8.    ClientWidth     =   7785
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   4575
  13.    ScaleWidth      =   7785
  14.    ShowInTaskbar   =   0   'False
  15.    Tag             =   "Employee"
  16.    Begin VB.CommandButton cmdClose 
  17.       Cancel          =   -1  'True
  18.       Caption         =   "&Close"
  19.       Default         =   -1  'True
  20.       Height          =   300
  21.       Left            =   5535
  22.       TabIndex        =   25
  23.       Top             =   3870
  24.       Width           =   975
  25.    End
  26.    Begin VB.CommandButton cmdGrid 
  27.       Caption         =   "&Grid"
  28.       Height          =   300
  29.       Left            =   4455
  30.       TabIndex        =   24
  31.       Tag             =   "&Grid"
  32.       Top             =   3870
  33.       Width           =   975
  34.    End
  35.    Begin VB.CommandButton cmdUpdate 
  36.       Caption         =   "&Update"
  37.       Height          =   300
  38.       Left            =   3375
  39.       TabIndex        =   23
  40.       Tag             =   "&Update"
  41.       Top             =   3870
  42.       Width           =   975
  43.    End
  44.    Begin VB.CommandButton cmdRefresh 
  45.       Caption         =   "&Refresh"
  46.       Height          =   300
  47.       Left            =   2280
  48.       TabIndex        =   22
  49.       Tag             =   "&Refresh"
  50.       Top             =   3870
  51.       Width           =   975
  52.    End
  53.    Begin VB.CommandButton cmdDelete 
  54.       Caption         =   "&Delete"
  55.       Height          =   300
  56.       Left            =   1200
  57.       TabIndex        =   21
  58.       Tag             =   "&Delete"
  59.       Top             =   3870
  60.       Width           =   975
  61.    End
  62.    Begin VB.CommandButton cmdAdd 
  63.       Caption         =   "&Add"
  64.       Height          =   300
  65.       Left            =   120
  66.       TabIndex        =   20
  67.       Tag             =   "&Add"
  68.       Top             =   3870
  69.       Width           =   975
  70.    End
  71.    Begin VB.Data Data1 
  72.       Align           =   2  'Align Bottom
  73.       Connect         =   "Access"
  74.       DatabaseName    =   ""
  75.       DefaultCursorType=   0  'DefaultCursor
  76.       DefaultType     =   2  'UseODBC
  77.       Exclusive       =   0   'False
  78.       Height          =   345
  79.       Left            =   0
  80.       Options         =   0
  81.       ReadOnly        =   0   'False
  82.       RecordsetType   =   1  'Dynaset
  83.       RecordSource    =   "Employee"
  84.       Top             =   4230
  85.       Width           =   7785
  86.    End
  87.    Begin VB.TextBox txtFields 
  88.       DataField       =   "Notes"
  89.       DataSource      =   "Data1"
  90.       Height          =   855
  91.       Index           =   9
  92.       Left            =   120
  93.       MultiLine       =   -1  'True
  94.       ScrollBars      =   2  'Vertical
  95.       TabIndex        =   19
  96.       Top             =   2880
  97.       Width           =   4305
  98.    End
  99.    Begin VB.TextBox txtFields 
  100.       DataField       =   "Extension"
  101.       DataSource      =   "Data1"
  102.       Height          =   285
  103.       Index           =   7
  104.       Left            =   1320
  105.       MaxLength       =   4
  106.       TabIndex        =   15
  107.       Top             =   2280
  108.       Width           =   3120
  109.    End
  110.    Begin VB.TextBox txtFields 
  111.       DataField       =   "Home Phone"
  112.       DataSource      =   "Data1"
  113.       Height          =   285
  114.       Index           =   6
  115.       Left            =   1320
  116.       MaxLength       =   20
  117.       TabIndex        =   13
  118.       Top             =   1960
  119.       Width           =   3120
  120.    End
  121.    Begin VB.TextBox txtFields 
  122.       DataField       =   "Hire Date"
  123.       DataSource      =   "Data1"
  124.       Height          =   285
  125.       Index           =   5
  126.       Left            =   1320
  127.       TabIndex        =   11
  128.       Top             =   1640
  129.       Width           =   1680
  130.    End
  131.    Begin VB.TextBox txtFields 
  132.       DataField       =   "Birth Date"
  133.       DataSource      =   "Data1"
  134.       Height          =   285
  135.       Index           =   4
  136.       Left            =   1320
  137.       TabIndex        =   9
  138.       Top             =   1320
  139.       Width           =   1680
  140.    End
  141.    Begin VB.TextBox txtFields 
  142.       DataField       =   "Position"
  143.       DataSource      =   "Data1"
  144.       Height          =   285
  145.       Index           =   3
  146.       Left            =   1320
  147.       MaxLength       =   30
  148.       TabIndex        =   7
  149.       Top             =   1000
  150.       Width           =   3120
  151.    End
  152.    Begin VB.TextBox txtFields 
  153.       DataField       =   "First Name"
  154.       DataSource      =   "Data1"
  155.       Height          =   285
  156.       Index           =   2
  157.       Left            =   1320
  158.       MaxLength       =   10
  159.       TabIndex        =   5
  160.       Top             =   680
  161.       Width           =   3120
  162.    End
  163.    Begin VB.TextBox txtFields 
  164.       DataField       =   "Last Name"
  165.       DataSource      =   "Data1"
  166.       Height          =   285
  167.       Index           =   1
  168.       Left            =   1320
  169.       MaxLength       =   20
  170.       TabIndex        =   3
  171.       Top             =   360
  172.       Width           =   3120
  173.    End
  174.    Begin VB.TextBox txtFields 
  175.       DataField       =   "Employee ID"
  176.       DataSource      =   "Data1"
  177.       Height          =   285
  178.       Index           =   0
  179.       Left            =   1320
  180.       TabIndex        =   1
  181.       Top             =   40
  182.       Width           =   1680
  183.    End
  184.    Begin VB.Label lblLabels 
  185.       Caption         =   "Notes:"
  186.       Height          =   255
  187.       Index           =   9
  188.       Left            =   120
  189.       TabIndex        =   18
  190.       Tag             =   "Notes:"
  191.       Top             =   2625
  192.       Width           =   1815
  193.    End
  194.    Begin VB.OLE oleFields 
  195.       DataField       =   "Photo"
  196.       DataSource      =   "Data1"
  197.       Height          =   3435
  198.       Index           =   8
  199.       Left            =   4650
  200.       OLETypeAllowed  =   1  'Embedded
  201.       SizeMode        =   3  'Zoom
  202.       TabIndex        =   17
  203.       Top             =   315
  204.       Width           =   2970
  205.    End
  206.    Begin VB.Label lblLabels 
  207.       Caption         =   "Photo:"
  208.       Height          =   255
  209.       Index           =   8
  210.       Left            =   4650
  211.       TabIndex        =   16
  212.       Tag             =   "Photo:"
  213.       Top             =   60
  214.       Width           =   1815
  215.    End
  216.    Begin VB.Label lblLabels 
  217.       Caption         =   "Extension:"
  218.       Height          =   255
  219.       Index           =   7
  220.       Left            =   120
  221.       TabIndex        =   14
  222.       Tag             =   "Extension:"
  223.       Top             =   2295
  224.       Width           =   1125
  225.    End
  226.    Begin VB.Label lblLabels 
  227.       Caption         =   "Home Phone:"
  228.       Height          =   255
  229.       Index           =   6
  230.       Left            =   120
  231.       TabIndex        =   12
  232.       Tag             =   "Home Phone:"
  233.       Top             =   1980
  234.       Width           =   1125
  235.    End
  236.    Begin VB.Label lblLabels 
  237.       Caption         =   "Hire Date:"
  238.       Height          =   255
  239.       Index           =   5
  240.       Left            =   120
  241.       TabIndex        =   10
  242.       Tag             =   "Hire Date:"
  243.       Top             =   1665
  244.       Width           =   1125
  245.    End
  246.    Begin VB.Label lblLabels 
  247.       Caption         =   "Birth Date:"
  248.       Height          =   255
  249.       Index           =   4
  250.       Left            =   120
  251.       TabIndex        =   8
  252.       Tag             =   "Birth Date:"
  253.       Top             =   1335
  254.       Width           =   1125
  255.    End
  256.    Begin VB.Label lblLabels 
  257.       Caption         =   "Position:"
  258.       Height          =   255
  259.       Index           =   3
  260.       Left            =   120
  261.       TabIndex        =   6
  262.       Tag             =   "Position:"
  263.       Top             =   1020
  264.       Width           =   1125
  265.    End
  266.    Begin VB.Label lblLabels 
  267.       Caption         =   "First Name:"
  268.       Height          =   255
  269.       Index           =   2
  270.       Left            =   120
  271.       TabIndex        =   4
  272.       Tag             =   "First Name:"
  273.       Top             =   705
  274.       Width           =   1125
  275.    End
  276.    Begin VB.Label lblLabels 
  277.       Caption         =   "Last Name:"
  278.       Height          =   255
  279.       Index           =   1
  280.       Left            =   120
  281.       TabIndex        =   2
  282.       Tag             =   "Last Name:"
  283.       Top             =   375
  284.       Width           =   1125
  285.    End
  286.    Begin VB.Label lblLabels 
  287.       Caption         =   "Employee ID:"
  288.       Height          =   255
  289.       Index           =   0
  290.       Left            =   120
  291.       TabIndex        =   0
  292.       Tag             =   "Employee ID:"
  293.       Top             =   60
  294.       Width           =   1125
  295.    End
  296. End
  297. Attribute VB_Name = "frmEmployee"
  298. Attribute VB_GlobalNameSpace = False
  299. Attribute VB_Creatable = False
  300. Attribute VB_PredeclaredId = True
  301. Attribute VB_Exposed = False
  302. Option Explicit
  303.  
  304. Private Sub cmdAdd_Click()
  305.     Data1.Recordset.AddNew
  306. End Sub
  307.  
  308.  
  309. Private Sub cmdClose_Click()
  310.   Me.Hide
  311. End Sub
  312.  
  313. Private Sub cmdDelete_Click()
  314.     'this may produce an error if you delete the last
  315.     'record or the only record in the recordset
  316.     With Data1.Recordset
  317.         .Delete
  318.         .MoveNext
  319.         If .EOF Then .MoveLast
  320.     End With
  321. End Sub
  322.  
  323.  
  324. Private Sub cmdRefresh_Click()
  325.     'this is really only needed for multi user apps
  326.     Data1.Refresh
  327. End Sub
  328.  
  329.  
  330. Private Sub cmdUpdate_Click()
  331.     Data1.UpdateRecord
  332.     Data1.Recordset.Bookmark = Data1.Recordset.LastModified
  333. End Sub
  334.  
  335.  
  336. Private Sub cmdGrid_Click()
  337.     On Error GoTo cmdGrid_ClickErr
  338.  
  339.  
  340.     Dim f As New frmDataGrid
  341.     Set f.Data1.Recordset = Data1.Recordset
  342.     f.Caption = Me.Caption & " Grid"
  343.     f.Show
  344.  
  345.  
  346.     Exit Sub
  347. cmdGrid_ClickErr:
  348. End Sub
  349.  
  350.  
  351. Private Sub Data1_Error(DataErr As Integer, Response As Integer)
  352.     'This is where you would put error handling code
  353.     'If you want to ignore errors, comment out the next line
  354.     'If you want to trap them, add code here to handle them
  355.     MsgBox "Data error event hit err:" & Error$(DataErr)
  356.     Response = 0  'throw away the error
  357. End Sub
  358.  
  359.  
  360. Private Sub Data1_Reposition()
  361.     Screen.MousePointer = vbDefault
  362.     On Error Resume Next
  363.     'This will display the current record position
  364.     'for dynasets and snapshots
  365.     Data1.Caption = "Record: " & (Data1.Recordset.AbsolutePosition + 1)
  366.     'for the table object you must set the index property when
  367.     'the recordset gets created and use the following line
  368.     'Data1.Caption = "Record: " & (Data1.Recordset.RecordCount * (Data1.Recordset.PercentPosition * 0.01)) + 1
  369. End Sub
  370.  
  371.  
  372. Private Sub Data1_Validate(Action As Integer, Save As Integer)
  373.     'This is where you put validation code
  374.     'This event gets called when the following actions occur
  375.     Select Case Action
  376.         Case vbDataActionMoveFirst
  377.         Case vbDataActionMovePrevious
  378.         Case vbDataActionMoveNext
  379.         Case vbDataActionMoveLast
  380.         Case vbDataActionAddNew
  381.         Case vbDataActionUpdate
  382.         Case vbDataActionDelete
  383.         Case vbDataActionFind
  384.         Case vbDataActionBookmark
  385.         Case vbDataActionClose
  386.             Screen.MousePointer = vbDefault
  387.     End Select
  388.     Screen.MousePointer = vbHourglass
  389. End Sub
  390.  
  391. Private Sub Form_Load()
  392.   Center Me
  393.   Me.Data1.DatabaseName = frmMain.gsDatabase
  394. End Sub
  395.  
  396. Private Sub Form_Unload(Cancel As Integer)
  397.     Screen.MousePointer = vbDefault
  398. End Sub
  399.  
  400.  
  401. Private Sub oleFields_DblClick(Index As Integer)
  402.     'this is the way to get data into an empty ole control
  403.     'and have it saved back to the table
  404.     oleFields(Index).InsertObjDlg
  405. End Sub
  406.  
  407.  
  408.  
  409.