VERSION 5.00
Object = "{0C8DE9F2-EAFC-44DF-A13F-B5A9B36ED780}#2.0#0"; "lvButton.ocx"
Begin VB.Form CreateAC 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "State Bank Of India - Create Account"
   ClientHeight    =   7710
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   9180
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   7710
   ScaleWidth      =   9180
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.TextBox txtACNumber 
      Alignment       =   1  'Right Justify
      Appearance      =   0  'Flat
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   2400
      MaxLength       =   5
      MultiLine       =   -1  'True
      TabIndex        =   3
      Top             =   5520
      Width           =   3015
   End
   Begin VB.TextBox txtPIN 
      Alignment       =   1  'Right Justify
      Appearance      =   0  'Flat
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   2400
      MaxLength       =   4
      MultiLine       =   -1  'True
      TabIndex        =   4
      Top             =   6240
      Width           =   3015
   End
   Begin lvButton.lvButtons_H cmdSubmit 
      Height          =   495
      Left            =   4200
      TabIndex        =   5
      Top             =   7080
      Width           =   2415
      _ExtentX        =   4260
      _ExtentY        =   873
      Caption         =   "&Submit"
      CapAlign        =   2
      BackStyle       =   2
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Palatino Linotype"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      cGradient       =   0
      Mode            =   0
      Value           =   0   'False
      ImgAlign        =   3
      Image           =   "CreateAC.frx":0000
      ImgSize         =   24
      cBack           =   -2147483633
   End
   Begin VB.TextBox txtAddress 
      Alignment       =   1  'Right Justify
      Appearance      =   0  'Flat
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   2400
      MultiLine       =   -1  'True
      TabIndex        =   1
      Top             =   3600
      Width           =   5175
   End
   Begin VB.TextBox txtContact 
      Alignment       =   1  'Right Justify
      Appearance      =   0  'Flat
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   2400
      MultiLine       =   -1  'True
      TabIndex        =   2
      Top             =   4560
      Width           =   5175
   End
   Begin VB.TextBox txtName 
      Alignment       =   1  'Right Justify
      Appearance      =   0  'Flat
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   2400
      MultiLine       =   -1  'True
      TabIndex        =   0
      Top             =   2880
      Width           =   3015
   End
   Begin lvButton.lvButtons_H cmdCancel 
      Height          =   495
      Left            =   6720
      TabIndex        =   6
      Top             =   7080
      Width           =   2415
      _ExtentX        =   4260
      _ExtentY        =   873
      Caption         =   "Cancel"
      CapAlign        =   2
      BackStyle       =   2
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Palatino Linotype"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      cGradient       =   0
      Mode            =   0
      Value           =   0   'False
      ImgAlign        =   3
      Image           =   "CreateAC.frx":652B
      ImgSize         =   24
      cBack           =   -2147483633
   End
   Begin VB.Label Label1 
      BackColor       =   &H000080FF&
      Height          =   1335
      Left            =   840
      TabIndex        =   14
      Top             =   0
      Width           =   1095
   End
   Begin VB.Label lblACNumber 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "A/C Number"
      BeginProperty Font 
         Name            =   "Palatino Linotype"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   390
      Left            =   480
      TabIndex        =   13
      Top             =   5520
      Width           =   1635
   End
   Begin VB.Label lblPIN 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "PIN"
      BeginProperty Font 
         Name            =   "Palatino Linotype"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   390
      Left            =   480
      TabIndex        =   12
      Top             =   6240
      Width           =   525
   End
   Begin VB.Line Line2 
      BorderWidth     =   2
      X1              =   0
      X2              =   9240
      Y1              =   6960
      Y2              =   6960
   End
   Begin VB.Line Line1 
      BorderWidth     =   2
      X1              =   0
      X2              =   9240
      Y1              =   2520
      Y2              =   2520
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Please fill all the fields correctly and clicking on Submit Button, Your Account will be Created."
      BeginProperty Font 
         Name            =   "Palatino Linotype"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   780
      Left            =   120
      TabIndex        =   11
      Top             =   1560
      Width           =   8655
      WordWrap        =   -1  'True
   End
   Begin VB.Image Image1 
      Height          =   1335
      Left            =   7200
      Picture         =   "CreateAC.frx":1927D
      Stretch         =   -1  'True
      Top             =   0
      Width           =   1695
   End
   Begin VB.Label Label11 
      BackColor       =   &H000080FF&
      Height          =   255
      Left            =   0
      TabIndex        =   10
      Top             =   1200
      Width           =   15255
   End
   Begin VB.Image SBI_Logo 
      Height          =   990
      Left            =   3000
      Picture         =   "CreateAC.frx":1D3E9
      Top             =   120
      Width           =   3540
   End
   Begin VB.Label lblContact 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Contact Info"
      BeginProperty Font 
         Name            =   "Palatino Linotype"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   390
      Left            =   480
      TabIndex        =   9
      Top             =   4560
      Width           =   1515
   End
   Begin VB.Label lblAddress 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Address"
      BeginProperty Font 
         Name            =   "Palatino Linotype"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   390
      Left            =   480
      TabIndex        =   8
      Top             =   3600
      Width           =   1155
   End
   Begin VB.Label lblName 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "User Name"
      BeginProperty Font 
         Name            =   "Palatino Linotype"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   390
      Left            =   480
      TabIndex        =   7
      Top             =   2880
      Width           =   1665
   End
End
Attribute VB_Name = "CreateAC"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim VerifyAC    As Boolean
Dim VerifyPIN   As Boolean
Dim SQL         As String
Dim FieldError  As Boolean

Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub cmdSubmit_Click()
CheckFields
If FieldError = True Then
    txtName.SetFocus
    Exit Sub
Else
    Check_ACRedundancy
End If

If (VerifyAC = True) Then
    Set rsAC = New ADODB.Recordset
    SQL = "tblUser"
    rsAC.Open SQL, CON, adOpenStatic, adLockOptimistic
    rsAC.AddNew
        GetData
        rsAC.Update
        MsgBox "Congratulations! Your Account is Created Successfully.", vbInformation, "SBI ATM Msg"
        rsAC.Close
        Unload CreateAC
        Exit Sub
    Else
        Exit Sub
End If
End Sub

Private Sub Form_Load()
Connection
End Sub

Sub CheckFields()
If Trim(txtName.Text) = "" Or Trim(txtAddress.Text) = "" Or Trim(txtContact.Text = "") _
                   Or Trim(txtACNumber.Text) = "" Or Trim(txtPIN.Text = "") Then
    FieldError = True
    MsgBox "Sorry!! Please Complete All fields.", vbExclamation, "SBI Create - Account Msg"
    Exit Sub
Else
    FieldError = False
End If
End Sub

Sub GetData()
rsAC.Fields("UserName") = txtName.Text
rsAC.Fields("Address") = txtAddress.Text
rsAC.Fields("Contact") = txtContact.Text
rsAC.Fields("ACNumber") = Val(txtACNumber.Text)
Encrypt (txtPIN.Text)
rsAC.Fields("PIN") = pwdEncrypted
rsAC.Fields("Cash") = 0                             ' Recommended Null Value
End Sub

Sub Check_ACRedundancy()
Dim CheckAC As Long
CheckAC = txtACNumber.Text
rsTransfer.Open "Select * from tblUser Where ACNumber =" & CheckAC, CON, adOpenStatic, adLockOptimistic
If rsTransfer.RecordCount > 0 Then
    VerifyAC = False
    MsgBox "The Account number entered has already been used. Please choose another PIN.", vbInformation, "SBI Create - Account Msg"
    txtACNumber.Text = ""
    txtACNumber.SetFocus
Else
    VerifyAC = True
End If
rsTransfer.Close
End Sub

