home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / truegrid / disk1 / genledgr / genledgr.$ / GLADD.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-02-17  |  2.7 KB  |  92 lines

  1. VERSION 2.00
  2. Begin Form AddForm 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Add Account..."
  6.    ClientHeight    =   1665
  7.    ClientLeft      =   2430
  8.    ClientTop       =   3165
  9.    ClientWidth     =   5775
  10.    Height          =   2070
  11.    Left            =   2370
  12.    LinkTopic       =   "Form2"
  13.    ScaleHeight     =   1665
  14.    ScaleWidth      =   5775
  15.    Top             =   2820
  16.    Width           =   5895
  17.    Begin CommandButton Command2 
  18.       Cancel          =   -1  'True
  19.       Caption         =   "Cancel"
  20.       Height          =   435
  21.       Left            =   3300
  22.       TabIndex        =   5
  23.       Top             =   1080
  24.       Width           =   1095
  25.    End
  26.    Begin CommandButton Command1 
  27.       Caption         =   "OK"
  28.       Default         =   -1  'True
  29.       Height          =   435
  30.       Left            =   4500
  31.       TabIndex        =   4
  32.       Top             =   1080
  33.       Width           =   1095
  34.    End
  35.    Begin TextBox Desc 
  36.       Height          =   285
  37.       Left            =   1380
  38.       TabIndex        =   3
  39.       Top             =   540
  40.       Width           =   4215
  41.    End
  42.    Begin TextBox AccountID 
  43.       Height          =   285
  44.       Left            =   1380
  45.       TabIndex        =   2
  46.       Top             =   180
  47.       Width           =   1575
  48.    End
  49.    Begin Label Label2 
  50.       Alignment       =   1  'Right Justify
  51.       BackColor       =   &H00C0C0C0&
  52.       Caption         =   "Description:"
  53.       Height          =   255
  54.       Left            =   180
  55.       TabIndex        =   1
  56.       Top             =   600
  57.       Width           =   1155
  58.    End
  59.    Begin Label Label1 
  60.       Alignment       =   1  'Right Justify
  61.       BackColor       =   &H00C0C0C0&
  62.       Caption         =   "Account #:"
  63.       Height          =   255
  64.       Left            =   180
  65.       TabIndex        =   0
  66.       Top             =   240
  67.       Width           =   1095
  68.    End
  69. Option Explicit
  70. Sub Command1_Click ()
  71.     On Error GoTo ermsg
  72.     ' Create a new account entry and display an error
  73.     ' message if there's an error (such as a duplicate).
  74.     Main.Data1.Recordset.AddNew
  75.     Main.Data1.Recordset!AccountID = Val(AccountID)
  76.     Main.Data1.Recordset!AccountName = Desc
  77.     Main.Data1.Recordset.Update
  78.     ' Refresh the grid so the account appears in proper
  79.     ' sorted order, then position to the account we just
  80.     ' added.
  81.     Main.Data1.Refresh
  82.     Main.Data1.Recordset.FindFirst "AccountID = " & AccountID
  83.     Unload AddForm
  84.     Exit Sub
  85. ermsg:
  86.     MsgBox Error$
  87.     Exit Sub
  88. End Sub
  89. Sub Command2_Click ()
  90.     Unload AddForm
  91. End Sub
  92.