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

  1. VERSION 5.00
  2. Begin VB.Form frmEmployeeAddresses 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Employee Addresses"
  5.    ClientHeight    =   3045
  6.    ClientLeft      =   480
  7.    ClientTop       =   1470
  8.    ClientWidth     =   6600
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   3045
  13.    ScaleWidth      =   6600
  14.    ShowInTaskbar   =   0   'False
  15.    Tag             =   "Employee Addresses"
  16.    Begin VB.CommandButton cmdClose 
  17.       Cancel          =   -1  'True
  18.       Caption         =   "&Close"
  19.       Default         =   -1  'True
  20.       Height          =   300
  21.       Left            =   5520
  22.       TabIndex        =   19
  23.       Top             =   2300
  24.       Width           =   975
  25.    End
  26.    Begin VB.CommandButton cmdGrid 
  27.       Caption         =   "&Grid"
  28.       Height          =   300
  29.       Left            =   4440
  30.       TabIndex        =   18
  31.       Tag             =   "&Grid"
  32.       Top             =   2300
  33.       Width           =   975
  34.    End
  35.    Begin VB.CommandButton cmdUpdate 
  36.       Caption         =   "&Update"
  37.       Height          =   300
  38.       Left            =   3360
  39.       TabIndex        =   17
  40.       Tag             =   "&Update"
  41.       Top             =   2300
  42.       Width           =   975
  43.    End
  44.    Begin VB.CommandButton cmdRefresh 
  45.       Caption         =   "&Refresh"
  46.       Height          =   300
  47.       Left            =   2280
  48.       TabIndex        =   16
  49.       Tag             =   "&Refresh"
  50.       Top             =   2300
  51.       Width           =   975
  52.    End
  53.    Begin VB.CommandButton cmdDelete 
  54.       Caption         =   "&Delete"
  55.       Height          =   300
  56.       Left            =   1200
  57.       TabIndex        =   15
  58.       Tag             =   "&Delete"
  59.       Top             =   2300
  60.       Width           =   975
  61.    End
  62.    Begin VB.CommandButton cmdAdd 
  63.       Caption         =   "&Add"
  64.       Height          =   300
  65.       Left            =   120
  66.       TabIndex        =   14
  67.       Tag             =   "&Add"
  68.       Top             =   2300
  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 Addresses"
  84.       Top             =   2700
  85.       Width           =   6600
  86.    End
  87.    Begin VB.TextBox txtFields 
  88.       DataField       =   "Postal Code"
  89.       DataSource      =   "Data1"
  90.       Height          =   285
  91.       Index           =   6
  92.       Left            =   2040
  93.       MaxLength       =   10
  94.       TabIndex        =   13
  95.       Top             =   1960
  96.       Width           =   3375
  97.    End
  98.    Begin VB.TextBox txtFields 
  99.       DataField       =   "Country"
  100.       DataSource      =   "Data1"
  101.       Height          =   285
  102.       Index           =   5
  103.       Left            =   2040
  104.       MaxLength       =   15
  105.       TabIndex        =   11
  106.       Top             =   1640
  107.       Width           =   3375
  108.    End
  109.    Begin VB.TextBox txtFields 
  110.       DataField       =   "Region"
  111.       DataSource      =   "Data1"
  112.       Height          =   285
  113.       Index           =   4
  114.       Left            =   2040
  115.       MaxLength       =   15
  116.       TabIndex        =   9
  117.       Top             =   1320
  118.       Width           =   3375
  119.    End
  120.    Begin VB.TextBox txtFields 
  121.       DataField       =   "City"
  122.       DataSource      =   "Data1"
  123.       Height          =   285
  124.       Index           =   3
  125.       Left            =   2040
  126.       MaxLength       =   15
  127.       TabIndex        =   7
  128.       Top             =   1000
  129.       Width           =   3375
  130.    End
  131.    Begin VB.TextBox txtFields 
  132.       DataField       =   "Address2"
  133.       DataSource      =   "Data1"
  134.       Height          =   285
  135.       Index           =   2
  136.       Left            =   2040
  137.       MaxLength       =   20
  138.       TabIndex        =   5
  139.       Top             =   680
  140.       Width           =   3375
  141.    End
  142.    Begin VB.TextBox txtFields 
  143.       DataField       =   "Address1"
  144.       DataSource      =   "Data1"
  145.       Height          =   285
  146.       Index           =   1
  147.       Left            =   2040
  148.       MaxLength       =   60
  149.       TabIndex        =   3
  150.       Top             =   360
  151.       Width           =   3375
  152.    End
  153.    Begin VB.TextBox txtFields 
  154.       DataField       =   "Employee ID"
  155.       DataSource      =   "Data1"
  156.       Height          =   285
  157.       Index           =   0
  158.       Left            =   2040
  159.       TabIndex        =   1
  160.       Top             =   40
  161.       Width           =   1935
  162.    End
  163.    Begin VB.Label lblLabels 
  164.       Caption         =   "Postal Code:"
  165.       Height          =   255
  166.       Index           =   6
  167.       Left            =   120
  168.       TabIndex        =   12
  169.       Tag             =   "Postal Code:"
  170.       Top             =   1980
  171.       Width           =   1005
  172.    End
  173.    Begin VB.Label lblLabels 
  174.       Caption         =   "Country:"
  175.       Height          =   255
  176.       Index           =   5
  177.       Left            =   120
  178.       TabIndex        =   10
  179.       Tag             =   "Country:"
  180.       Top             =   1665
  181.       Width           =   1005
  182.    End
  183.    Begin VB.Label lblLabels 
  184.       Caption         =   "Region:"
  185.       Height          =   255
  186.       Index           =   4
  187.       Left            =   120
  188.       TabIndex        =   8
  189.       Tag             =   "Region:"
  190.       Top             =   1335
  191.       Width           =   1005
  192.    End
  193.    Begin VB.Label lblLabels 
  194.       Caption         =   "City:"
  195.       Height          =   255
  196.       Index           =   3
  197.       Left            =   120
  198.       TabIndex        =   6
  199.       Tag             =   "City:"
  200.       Top             =   1020
  201.       Width           =   1005
  202.    End
  203.    Begin VB.Label lblLabels 
  204.       Caption         =   "Address2:"
  205.       Height          =   255
  206.       Index           =   2
  207.       Left            =   120
  208.       TabIndex        =   4
  209.       Tag             =   "Address2:"
  210.       Top             =   705
  211.       Width           =   1005
  212.    End
  213.    Begin VB.Label lblLabels 
  214.       Caption         =   "Address1:"
  215.       Height          =   255
  216.       Index           =   1
  217.       Left            =   120
  218.       TabIndex        =   2
  219.       Tag             =   "Address1:"
  220.       Top             =   375
  221.       Width           =   1005
  222.    End
  223.    Begin VB.Label lblLabels 
  224.       Caption         =   "Employee ID:"
  225.       Height          =   255
  226.       Index           =   0
  227.       Left            =   120
  228.       TabIndex        =   0
  229.       Tag             =   "Employee ID:"
  230.       Top             =   60
  231.       Width           =   1005
  232.    End
  233. End
  234. Attribute VB_Name = "frmEmployeeAddresses"
  235. Attribute VB_GlobalNameSpace = False
  236. Attribute VB_Creatable = False
  237. Attribute VB_PredeclaredId = True
  238. Attribute VB_Exposed = False
  239. Option Explicit
  240.  
  241. Private Sub cmdAdd_Click()
  242.     Data1.Recordset.AddNew
  243. End Sub
  244.  
  245.  
  246. Private Sub cmdClose_Click()
  247.   Me.Hide
  248. End Sub
  249.  
  250. Private Sub cmdDelete_Click()
  251.     'this may produce an error if you delete the last
  252.     'record or the only record in the recordset
  253.     With Data1.Recordset
  254.         .Delete
  255.         .MoveNext
  256.         If .EOF Then .MoveLast
  257.     End With
  258. End Sub
  259.  
  260.  
  261. Private Sub cmdRefresh_Click()
  262.     'this is really only needed for multi user apps
  263.     Data1.Refresh
  264. End Sub
  265.  
  266.  
  267. Private Sub cmdUpdate_Click()
  268.     Data1.UpdateRecord
  269.     Data1.Recordset.Bookmark = Data1.Recordset.LastModified
  270. End Sub
  271.  
  272.  
  273. Private Sub cmdGrid_Click()
  274.     On Error GoTo cmdGrid_ClickErr
  275.  
  276.  
  277.     Dim f As New frmDataGrid
  278.     Set f.Data1.Recordset = Data1.Recordset
  279.     f.Caption = Me.Caption & " Grid"
  280.     f.Show
  281.  
  282.  
  283.     Exit Sub
  284. cmdGrid_ClickErr:
  285. End Sub
  286.  
  287.  
  288. Private Sub Data1_Error(DataErr As Integer, Response As Integer)
  289.     'This is where you would put error handling code
  290.     'If you want to ignore errors, comment out the next line
  291.     'If you want to trap them, add code here to handle them
  292.     MsgBox "Data error event hit err:" & Error$(DataErr)
  293.     Response = 0  'throw away the error
  294. End Sub
  295.  
  296.  
  297. Private Sub Data1_Reposition()
  298.     Screen.MousePointer = vbDefault
  299.     On Error Resume Next
  300.     'This will display the current record position
  301.     'for dynasets and snapshots
  302.     Data1.Caption = "Record: " & (Data1.Recordset.AbsolutePosition + 1)
  303.     'for the table object you must set the index property when
  304.     'the recordset gets created and use the following line
  305.     'Data1.Caption = "Record: " & (Data1.Recordset.RecordCount * (Data1.Recordset.PercentPosition * 0.01)) + 1
  306. End Sub
  307.  
  308.  
  309. Private Sub Data1_Validate(Action As Integer, Save As Integer)
  310.     'This is where you put validation code
  311.     'This event gets called when the following actions occur
  312.     Select Case Action
  313.         Case vbDataActionMoveFirst
  314.         Case vbDataActionMovePrevious
  315.         Case vbDataActionMoveNext
  316.         Case vbDataActionMoveLast
  317.         Case vbDataActionAddNew
  318.         Case vbDataActionUpdate
  319.         Case vbDataActionDelete
  320.         Case vbDataActionFind
  321.         Case vbDataActionBookmark
  322.         Case vbDataActionClose
  323.             Screen.MousePointer = vbDefault
  324.     End Select
  325.     Screen.MousePointer = vbHourglass
  326. End Sub
  327.  
  328. Private Sub Form_Load()
  329.   Center Me
  330.   Me.Data1.DatabaseName = frmMain.gsDatabase
  331. End Sub
  332.  
  333. Private Sub Form_Unload(Cancel As Integer)
  334.     Screen.MousePointer = vbDefault
  335. End Sub
  336.  
  337.  
  338.  
  339.