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

  1. VERSION 5.00
  2. Begin VB.Form frmCustomer 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Customer"
  5.    ClientHeight    =   5925
  6.    ClientLeft      =   615
  7.    ClientTop       =   675
  8.    ClientWidth     =   6720
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   5925
  13.    ScaleWidth      =   6720
  14.    ShowInTaskbar   =   0   'False
  15.    Tag             =   "Customer"
  16.    Begin VB.CommandButton cmdClose 
  17.       Cancel          =   -1  'True
  18.       Caption         =   "&Close"
  19.       Default         =   -1  'True
  20.       Height          =   300
  21.       Left            =   5520
  22.       TabIndex        =   37
  23.       Top             =   5180
  24.       Width           =   1035
  25.    End
  26.    Begin VB.CommandButton cmdGrid 
  27.       Caption         =   "&Grid"
  28.       Height          =   300
  29.       Left            =   4440
  30.       TabIndex        =   36
  31.       Tag             =   "&Grid"
  32.       Top             =   5180
  33.       Width           =   975
  34.    End
  35.    Begin VB.CommandButton cmdUpdate 
  36.       Caption         =   "&Update"
  37.       Height          =   300
  38.       Left            =   3360
  39.       TabIndex        =   35
  40.       Tag             =   "&Update"
  41.       Top             =   5180
  42.       Width           =   975
  43.    End
  44.    Begin VB.CommandButton cmdRefresh 
  45.       Caption         =   "&Refresh"
  46.       Height          =   300
  47.       Left            =   2280
  48.       TabIndex        =   34
  49.       Tag             =   "&Refresh"
  50.       Top             =   5180
  51.       Width           =   975
  52.    End
  53.    Begin VB.CommandButton cmdDelete 
  54.       Caption         =   "&Delete"
  55.       Height          =   300
  56.       Left            =   1200
  57.       TabIndex        =   33
  58.       Tag             =   "&Delete"
  59.       Top             =   5180
  60.       Width           =   975
  61.    End
  62.    Begin VB.CommandButton cmdAdd 
  63.       Caption         =   "&Add"
  64.       Height          =   300
  65.       Left            =   120
  66.       TabIndex        =   32
  67.       Tag             =   "&Add"
  68.       Top             =   5180
  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    =   "Customer"
  84.       Top             =   5580
  85.       Width           =   6720
  86.    End
  87.    Begin VB.TextBox txtFields 
  88.       DataField       =   "Fax"
  89.       DataSource      =   "Data1"
  90.       Height          =   285
  91.       Index           =   15
  92.       Left            =   2040
  93.       MaxLength       =   20
  94.       TabIndex        =   31
  95.       Top             =   4840
  96.       Width           =   3375
  97.    End
  98.    Begin VB.TextBox txtFields 
  99.       DataField       =   "Phone"
  100.       DataSource      =   "Data1"
  101.       Height          =   285
  102.       Index           =   14
  103.       Left            =   2040
  104.       MaxLength       =   20
  105.       TabIndex        =   29
  106.       Top             =   4520
  107.       Width           =   3375
  108.    End
  109.    Begin VB.TextBox txtFields 
  110.       DataField       =   "Postal Code"
  111.       DataSource      =   "Data1"
  112.       Height          =   285
  113.       Index           =   13
  114.       Left            =   2040
  115.       MaxLength       =   10
  116.       TabIndex        =   27
  117.       Top             =   4200
  118.       Width           =   3375
  119.    End
  120.    Begin VB.TextBox txtFields 
  121.       DataField       =   "Country"
  122.       DataSource      =   "Data1"
  123.       Height          =   285
  124.       Index           =   12
  125.       Left            =   2040
  126.       MaxLength       =   15
  127.       TabIndex        =   25
  128.       Top             =   3880
  129.       Width           =   3375
  130.    End
  131.    Begin VB.TextBox txtFields 
  132.       DataField       =   "Region"
  133.       DataSource      =   "Data1"
  134.       Height          =   285
  135.       Index           =   11
  136.       Left            =   2040
  137.       MaxLength       =   15
  138.       TabIndex        =   23
  139.       Top             =   3560
  140.       Width           =   3375
  141.    End
  142.    Begin VB.TextBox txtFields 
  143.       DataField       =   "City"
  144.       DataSource      =   "Data1"
  145.       Height          =   285
  146.       Index           =   10
  147.       Left            =   2040
  148.       MaxLength       =   20
  149.       TabIndex        =   21
  150.       Top             =   3240
  151.       Width           =   3375
  152.    End
  153.    Begin VB.TextBox txtFields 
  154.       DataField       =   "Address2"
  155.       DataSource      =   "Data1"
  156.       Height          =   285
  157.       Index           =   9
  158.       Left            =   2040
  159.       MaxLength       =   20
  160.       TabIndex        =   19
  161.       Top             =   2920
  162.       Width           =   3375
  163.    End
  164.    Begin VB.TextBox txtFields 
  165.       DataField       =   "Address1"
  166.       DataSource      =   "Data1"
  167.       Height          =   285
  168.       Index           =   8
  169.       Left            =   2040
  170.       MaxLength       =   60
  171.       TabIndex        =   17
  172.       Top             =   2600
  173.       Width           =   3375
  174.    End
  175.    Begin VB.TextBox txtFields 
  176.       DataField       =   "Last Year's Sales"
  177.       DataSource      =   "Data1"
  178.       Height          =   285
  179.       Index           =   7
  180.       Left            =   2040
  181.       TabIndex        =   15
  182.       Top             =   2280
  183.       Width           =   1935
  184.    End
  185.    Begin VB.TextBox txtFields 
  186.       DataField       =   "Account Manager"
  187.       DataSource      =   "Data1"
  188.       Height          =   285
  189.       Index           =   6
  190.       Left            =   2040
  191.       MaxLength       =   50
  192.       TabIndex        =   13
  193.       Top             =   1960
  194.       Width           =   3375
  195.    End
  196.    Begin VB.TextBox txtFields 
  197.       DataField       =   "Contact Position"
  198.       DataSource      =   "Data1"
  199.       Height          =   285
  200.       Index           =   5
  201.       Left            =   2040
  202.       MaxLength       =   30
  203.       TabIndex        =   11
  204.       Top             =   1640
  205.       Width           =   3375
  206.    End
  207.    Begin VB.TextBox txtFields 
  208.       DataField       =   "Contact Title"
  209.       DataSource      =   "Data1"
  210.       Height          =   285
  211.       Index           =   4
  212.       Left            =   2040
  213.       MaxLength       =   5
  214.       TabIndex        =   9
  215.       Top             =   1320
  216.       Width           =   3375
  217.    End
  218.    Begin VB.TextBox txtFields 
  219.       DataField       =   "Contact Last Name"
  220.       DataSource      =   "Data1"
  221.       Height          =   285
  222.       Index           =   3
  223.       Left            =   2040
  224.       MaxLength       =   30
  225.       TabIndex        =   7
  226.       Top             =   1000
  227.       Width           =   3375
  228.    End
  229.    Begin VB.TextBox txtFields 
  230.       DataField       =   "Contact First Name"
  231.       DataSource      =   "Data1"
  232.       Height          =   285
  233.       Index           =   2
  234.       Left            =   2040
  235.       MaxLength       =   30
  236.       TabIndex        =   5
  237.       Top             =   680
  238.       Width           =   3375
  239.    End
  240.    Begin VB.TextBox txtFields 
  241.       DataField       =   "Customer Name"
  242.       DataSource      =   "Data1"
  243.       Height          =   285
  244.       Index           =   1
  245.       Left            =   2040
  246.       MaxLength       =   40
  247.       TabIndex        =   3
  248.       Top             =   360
  249.       Width           =   3375
  250.    End
  251.    Begin VB.TextBox txtFields 
  252.       DataField       =   "Customer ID"
  253.       DataSource      =   "Data1"
  254.       Height          =   285
  255.       Index           =   0
  256.       Left            =   2040
  257.       TabIndex        =   1
  258.       Top             =   40
  259.       Width           =   1935
  260.    End
  261.    Begin VB.Label lblLabels 
  262.       Caption         =   "Fax:"
  263.       Height          =   255
  264.       Index           =   15
  265.       Left            =   120
  266.       TabIndex        =   30
  267.       Tag             =   "Fax:"
  268.       Top             =   4860
  269.       Width           =   1815
  270.    End
  271.    Begin VB.Label lblLabels 
  272.       Caption         =   "Phone:"
  273.       Height          =   255
  274.       Index           =   14
  275.       Left            =   120
  276.       TabIndex        =   28
  277.       Tag             =   "Phone:"
  278.       Top             =   4540
  279.       Width           =   1815
  280.    End
  281.    Begin VB.Label lblLabels 
  282.       Caption         =   "Postal Code:"
  283.       Height          =   255
  284.       Index           =   13
  285.       Left            =   120
  286.       TabIndex        =   26
  287.       Tag             =   "Postal Code:"
  288.       Top             =   4220
  289.       Width           =   1815
  290.    End
  291.    Begin VB.Label lblLabels 
  292.       Caption         =   "Country:"
  293.       Height          =   255
  294.       Index           =   12
  295.       Left            =   120
  296.       TabIndex        =   24
  297.       Tag             =   "Country:"
  298.       Top             =   3900
  299.       Width           =   1815
  300.    End
  301.    Begin VB.Label lblLabels 
  302.       Caption         =   "Region:"
  303.       Height          =   255
  304.       Index           =   11
  305.       Left            =   120
  306.       TabIndex        =   22
  307.       Tag             =   "Region:"
  308.       Top             =   3580
  309.       Width           =   1815
  310.    End
  311.    Begin VB.Label lblLabels 
  312.       Caption         =   "City:"
  313.       Height          =   255
  314.       Index           =   10
  315.       Left            =   120
  316.       TabIndex        =   20
  317.       Tag             =   "City:"
  318.       Top             =   3260
  319.       Width           =   1815
  320.    End
  321.    Begin VB.Label lblLabels 
  322.       Caption         =   "Address2:"
  323.       Height          =   255
  324.       Index           =   9
  325.       Left            =   120
  326.       TabIndex        =   18
  327.       Tag             =   "Address2:"
  328.       Top             =   2940
  329.       Width           =   1815
  330.    End
  331.    Begin VB.Label lblLabels 
  332.       Caption         =   "Address1:"
  333.       Height          =   255
  334.       Index           =   8
  335.       Left            =   120
  336.       TabIndex        =   16
  337.       Tag             =   "Address1:"
  338.       Top             =   2620
  339.       Width           =   1815
  340.    End
  341.    Begin VB.Label lblLabels 
  342.       Caption         =   "Last Year's Sales:"
  343.       Height          =   255
  344.       Index           =   7
  345.       Left            =   120
  346.       TabIndex        =   14
  347.       Tag             =   "Last Year's Sales:"
  348.       Top             =   2300
  349.       Width           =   1815
  350.    End
  351.    Begin VB.Label lblLabels 
  352.       Caption         =   "Account Manager:"
  353.       Height          =   255
  354.       Index           =   6
  355.       Left            =   120
  356.       TabIndex        =   12
  357.       Tag             =   "Account Manager:"
  358.       Top             =   1980
  359.       Width           =   1815
  360.    End
  361.    Begin VB.Label lblLabels 
  362.       Caption         =   "Contact Position:"
  363.       Height          =   255
  364.       Index           =   5
  365.       Left            =   120
  366.       TabIndex        =   10
  367.       Tag             =   "Contact Position:"
  368.       Top             =   1660
  369.       Width           =   1815
  370.    End
  371.    Begin VB.Label lblLabels 
  372.       Caption         =   "Contact Title:"
  373.       Height          =   255
  374.       Index           =   4
  375.       Left            =   120
  376.       TabIndex        =   8
  377.       Tag             =   "Contact Title:"
  378.       Top             =   1340
  379.       Width           =   1815
  380.    End
  381.    Begin VB.Label lblLabels 
  382.       Caption         =   "Contact Last Name:"
  383.       Height          =   255
  384.       Index           =   3
  385.       Left            =   120
  386.       TabIndex        =   6
  387.       Tag             =   "Contact Last Name:"
  388.       Top             =   1020
  389.       Width           =   1815
  390.    End
  391.    Begin VB.Label lblLabels 
  392.       Caption         =   "Contact First Name:"
  393.       Height          =   255
  394.       Index           =   2
  395.       Left            =   120
  396.       TabIndex        =   4
  397.       Tag             =   "Contact First Name:"
  398.       Top             =   700
  399.       Width           =   1815
  400.    End
  401.    Begin VB.Label lblLabels 
  402.       Caption         =   "Customer Name:"
  403.       Height          =   255
  404.       Index           =   1
  405.       Left            =   120
  406.       TabIndex        =   2
  407.       Tag             =   "Customer Name:"
  408.       Top             =   380
  409.       Width           =   1815
  410.    End
  411.    Begin VB.Label lblLabels 
  412.       Caption         =   "Customer ID:"
  413.       Height          =   255
  414.       Index           =   0
  415.       Left            =   120
  416.       TabIndex        =   0
  417.       Tag             =   "Customer ID:"
  418.       Top             =   60
  419.       Width           =   1815
  420.    End
  421. End
  422. Attribute VB_Name = "frmCustomer"
  423. Attribute VB_GlobalNameSpace = False
  424. Attribute VB_Creatable = False
  425. Attribute VB_PredeclaredId = True
  426. Attribute VB_Exposed = False
  427. Option Explicit
  428.  
  429. Private Sub cmdAdd_Click()
  430.     Data1.Recordset.AddNew
  431. End Sub
  432.  
  433.  
  434. Private Sub cmdClose_Click()
  435.   Me.Hide
  436. End Sub
  437.  
  438. Private Sub cmdDelete_Click()
  439.     'this may produce an error if you delete the last
  440.     'record or the only record in the recordset
  441.     With Data1.Recordset
  442.         .Delete
  443.         .MoveNext
  444.         If .EOF Then .MoveLast
  445.     End With
  446. End Sub
  447.  
  448.  
  449. Private Sub cmdRefresh_Click()
  450.     'this is really only needed for multi user apps
  451.     Data1.Refresh
  452. End Sub
  453.  
  454.  
  455. Private Sub cmdUpdate_Click()
  456.     Data1.UpdateRecord
  457.     Data1.Recordset.Bookmark = Data1.Recordset.LastModified
  458. End Sub
  459.  
  460.  
  461. Private Sub cmdGrid_Click()
  462.     On Error GoTo cmdGrid_ClickErr
  463.  
  464.  
  465.     Dim f As New frmDataGrid
  466.     Set f.Data1.Recordset = Data1.Recordset
  467.     f.Caption = Me.Caption & " Grid"
  468.     f.Show
  469.  
  470.  
  471.     Exit Sub
  472. cmdGrid_ClickErr:
  473. End Sub
  474.  
  475.  
  476. Private Sub Data1_Error(DataErr As Integer, Response As Integer)
  477.     'This is where you would put error handling code
  478.     'If you want to ignore errors, comment out the next line
  479.     'If you want to trap them, add code here to handle them
  480.     MsgBox "Data error event hit err:" & Error$(DataErr)
  481.     Response = 0  'throw away the error
  482. End Sub
  483.  
  484.  
  485. Private Sub Data1_Reposition()
  486.     Screen.MousePointer = vbDefault
  487.     On Error Resume Next
  488.     'This will display the current record position
  489.     'for dynasets and snapshots
  490.     Data1.Caption = "Record: " & (Data1.Recordset.AbsolutePosition + 1)
  491.     'for the table object you must set the index property when
  492.     'the recordset gets created and use the following line
  493.     'Data1.Caption = "Record: " & (Data1.Recordset.RecordCount * (Data1.Recordset.PercentPosition * 0.01)) + 1
  494. End Sub
  495.  
  496.  
  497. Private Sub Data1_Validate(Action As Integer, Save As Integer)
  498.     'This is where you put validation code
  499.     'This event gets called when the following actions occur
  500.     Select Case Action
  501.         Case vbDataActionMoveFirst
  502.         Case vbDataActionMovePrevious
  503.         Case vbDataActionMoveNext
  504.         Case vbDataActionMoveLast
  505.         Case vbDataActionAddNew
  506.         Case vbDataActionUpdate
  507.         Case vbDataActionDelete
  508.         Case vbDataActionFind
  509.         Case vbDataActionBookmark
  510.         Case vbDataActionClose
  511.             Screen.MousePointer = vbDefault
  512.     End Select
  513.     Screen.MousePointer = vbHourglass
  514. End Sub
  515.  
  516. Private Sub Form_Load()
  517.   Center Me
  518.   Me.Data1.DatabaseName = frmMain.gsDatabase
  519. End Sub
  520.  
  521. Private Sub Form_Unload(Cancel As Integer)
  522.     Screen.MousePointer = vbDefault
  523. End Sub
  524.  
  525.  
  526.  
  527.