Categories
Visual Basic 6.0

Information System

Information System in Visual Basic 6.0 and MS Access 2007 back end. It is used in an office to register, update and delete client information. System also can generate Monthly and Yearly Reports like Expiry Passport, No Passport, No Insurance and Beneficiary and Client List Report.

System Password: admin

Developed by my friend

Johnny Paragas
Larry Emol

If you want to get source code, please click Download Code button on below link. For more information about the system. You can contact me @ Email – larrydaveemol@gmail.com

Let me know what you need just leave a message/comment and I will do my very best to make that happen. I hope this codes will help you. Enjoy Coding!

Categories
Visual Basic 6.0

Login with SQL Server Database in Vb6

This is a sample login application that use in your project application system in VB6. Let’s start coding.

Create a Module copy the codes below for database connection in order to connect to the SQL Server database and put the following code inside it.

Option Explicit

'variables for ADODB
Global Connect As New ADODB.Connection

Public Sub SQLDB(adoObj As Adodc, AdoRec As String) 'for SQL Recordsource
'Connection string: workstation id=koroikadb.mssql.somee.com;packet size=4096;user id=xxxxxx;pwd=yyyyyy;data source=koroikadb.mssql.somee.com;persist security info=False;initial catalog=koroikadb
    'Loads the database and provides the database password
    adoObj.ConnectionString = "Provider=sqloledb;user id=;pwd=;Data Source=(local);persist security info=False;Initial Catalog=Tutorial;Trusted_Connection=Yes;"
    
    'Sets the command type to Table
    adoObj.CommandType = adCmdText
    
    'Loads the source table of info
    adoObj.RecordSource = AdoRec

    'refreshes database status
     adoObj.Refresh
End Sub

Sub Main()
On Error Resume Next
Call SQLDB(Form1.Adodc1, "Select * from tblSecurity ")
If Form1.Adodc1.Recordset.RecordCount = 0 Then
    Form1.Adodc1.Recordset.AddNew
    Form1.Adodc1.Recordset.Fields("USERNAME") = "admin"
    Form1.Adodc1.Recordset.Fields("PASSWORD") = "admin"
    Form1.Adodc1.Recordset.Update
End If

Form1.Show
End Sub

After creating module we need to create form to your project and double click the form to enter the code window Copy the code below and paste then save it.

Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Image1.Picture = Me.Image3.Picture
End Sub

Private Sub Image2_Click()
On Error Resume Next
If Me.Text1.Text = "" Or Me.Text2.Text = "" Then
MsgBox "Login and password should not be blank", vbInformation, "Login"
Exit Sub
End If

Call SQLDB(Me.Adodc1, "Select * from tblSecurity where USERNAME='" & Me.Text1.Text & "' and PASSWORD='" & Me.Text2.Text & "'")
If Me.Adodc1.Recordset.Fields("USERNAME") = Me.Text1.Text Then
   MsgBox "Please input correct username and password", vbCritical, "Login"
Else
    Unload Me
    Form2.Show
End If
End Sub

Private Sub Image2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Image1.Picture = Me.Picture1.Picture
End Sub

For more information about the system. You can contact me @
Email – larrydaveemol@gmail.com
FB Account – https://www.facebook.com/larrydavelacapagemol

Let me know what you need just leave a message/comment and I will do my very best to make that happen. I hope this codes will help you. Enjoy Coding!

Categories
Visual Basic 6.0

VB.NET CRUD with SQL Server Database

I would like to share my basic program you’ll learn from this on how to build a CRUD application with VB.Net and SQL Server Database. This system will help you specially for beginners. It is fully working.

Features :

  • Can add/update/delete/search info.
  • Can view info.

Back-end:
SQL Server Management Studio

Download the complete source code for more information about the system. You can contact me @
Email – larrydaveemol@gmail.com

Let me know what you need just leave a message/comment and I will do my very best to make that happen. I hope this codes will help you. Enjoy Coding!

Categories
Visual Basic 6.0

Insert, Update, Delete, Display, Search Data in MySQL Using Vb.net

I would like to share my basic program you’ll learn from this on how to build a CRUD application with VB.Net and MySQL. First, you have to install Net/connector 5.2 with MySql server 5.0 that run in Visual Studio 2010 Express.

Note: You need to include this assembly.

  1. using MySql.Data.MySqlClient; //for MySQL 

Create module to your project, copy codes below for your database connection.

Option Explicit

Public MyConn As ADODB.Connection
Public rstUserAcct As ADODB.Recordset

Sub Main()
On Error Resume Next
        Set MyConn = New ADODB.Connection
        Set rstUserAcct = New ADODB.Recordset
        MyConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & AppDir & "Tutorial.mdb;Persist Security Info=False;Jet OLEDB:Database Password =IT098"
        MyConn.CursorLocation = adUseClient
        'Start up object
        Mainform.Show
End Sub

Public Function AppDir() As String
    If Right$(App.Path, 1) = "" Then
        AppDir = App.Path
    Else
        AppDir = App.Path & ""
    End If
End Function

Create form to your project and double click the form to enter the code window Copy the code below and paste then save it.

Private Sub Command1_Click()
  Form1.Show 1
End Sub

Private Sub Command2_Click()
If Me.Tag = "" Then
 	MsgBox "Please select data to update", vbCritical, "Crud"
Else
  Form1.Text2.Text = Me.Listview1.selectedItem.ListSubItems(3)
  Form1.Text3.Text = Listview1.selectedItem.ListSubItems(4)
  Form1.Text4.Text = Listview1.selectedItem.ListSubItems(5)
  Form1.Command1.Caption = "UPDATE"
  Form1.Caption = "UPDATE"
  Form1.Show 1, Mainform
End If
End Sub

Private Sub Command3_Click()
'On Error Resume Next
If Me.Tag = "" Then
 MsgBox "Please select data to delete", vbCritical, "Crud"
Else
Set rstUserAcct = New ADODB.Recordset
    If rstUserAcct.State = 1 Then rstUserAcct.Close
    rstUserAcct.Open "Select * from tblInfo where ID like'" & Me.Tag & "'", MyConn, adOpenDynamic, adLockBatchOptimistic
    rstUserAcct.Delete
    rstUserAcct.UpdateBatch
    data
    MsgBox "Successfully Deleted", vbInformation, "DELETE"
    Me.Tag = ""
End If
End Sub

Private Sub Form_Activate()
data
End Sub

Sub data()
On Error Resume Next
Dim lst
Dim cnt As Integer
Dim X As Integer
Set rstUserAcct = New ADODB.Recordset
    If rstUserAcct.State = 1 Then rstUserAcct.Close
    rstUserAcct.Open "Select * from tblInfo", MyConn, adOpenDynamic, adLockBatchOptimistic
    
With Me.Listview1
    .ColumnHeaders.Clear
    .ListItems.Clear
    .ColumnHeaders.Add , , "", 0
    .ColumnHeaders.Add , , "USERNAME", 3000
    .ColumnHeaders.Add , , "PASSWORD", 4000
    .ColumnHeaders.Add , , "FISTNAME", 4000
    .ColumnHeaders.Add , , "MIDDLENAME", 4000
    .ColumnHeaders.Add , , "LASTNAME", 4000
End With
Do Until rstUserAcct.EOF
    Set lst = Listview1.ListItems.Add(, , rstUserAcct.Fields!ID)
        lst.ListSubItems.Add , , rstUserAcct.Fields!UserName
        lst.ListSubItems.Add , , rstUserAcct.Fields!Password
        lst.ListSubItems.Add , , rstUserAcct.Fields!firstname
        lst.ListSubItems.Add , , rstUserAcct.Fields!middlename
        lst.ListSubItems.Add , , rstUserAcct.Fields!lastname
  cnt = cnt + 1
rstUserAcct.MoveNext
Loop
Label1.Caption = "Total No. of record(s): " & cnt
End Sub

Private Sub Form_Unload(Cancel As Integer)
End
End Sub

Private Sub Listview1_Click()
Me.Tag = Me.Listview1.selectedItem.Text
End Sub

Download the complete source code for more information about the system. You can contact me @
Email – larrydaveemol@gmail.com

Let me know what you need just leave a message/comment and I will do my very best to make that happen. I hope this codes will help you. Enjoy Coding!

Categories
Visual Basic 6.0

Profiling and Grade Monitoring System

This Profiling and Grade Monitoring System is developed using Visual Basic 6 and MS Access 2003 database. The purpose of this study is to computerized profiling system that will upgrade and create automated registration process and help the students become aware of his/her academic status.

These are the following features of the system

  • Manage Instructor Information 
  • Manage Student Information
  • Manage Department
  • Manage Subjects
  • Manage student Grades

RESEARCHERS
West Visayas State University – Calinog Campus

Kevin James Tillaflor
Ronel Dela Cruz
J-An Marie Fresnillo

For more information about the system. You can contact me @
Email – larrydaveemol@gmail.com

Let me know what you need just leave a message/comment and I will do my very best to make that happen. I hope this codes will help you. Enjoy Coding!

Categories
Visual Basic 6.0

VB6 ADODB Connection CRUD Application

In this program you’ll learn how to build a CRUD application with VB6 and MSAccess. First, you have to add the component: Microsoft Windows Common Controls 6.0 (SP6) and listview control.

Create module to your project, copy codes below for your database connection.

Option Explicit

Public MyConn As ADODB.Connection
Public rstUserAcct As ADODB.Recordset

Sub Main()
On Error Resume Next
        Set MyConn = New ADODB.Connection
        Set rstUserAcct = New ADODB.Recordset
        MyConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & AppDir & "Tutorial.mdb;Persist Security Info=False;Jet OLEDB:Database Password =IT098"
        MyConn.CursorLocation = adUseClient
        'Start up object
        Mainform.Show
End Sub

Public Function AppDir() As String
    If Right$(App.Path, 1) = "\" Then
        AppDir = App.Path
    Else
        AppDir = App.Path & "\"
    End If
End Function

Create form to your project and double click the form to enter the code window Copy the code below and paste then save it.

Private Sub Command1_Click()
  Form1.Show 1
End Sub

Private Sub Command2_Click()
If Me.Tag = "" Then
 	MsgBox "Please select data to update", vbCritical, "Crud"
Else
  Form1.Text2.Text = Me.Listview1.selectedItem.ListSubItems(3)
  Form1.Text3.Text = Listview1.selectedItem.ListSubItems(4)
  Form1.Text4.Text = Listview1.selectedItem.ListSubItems(5)
  Form1.Command1.Caption = "UPDATE"
  Form1.Caption = "UPDATE"
  Form1.Show 1, Mainform
End If
End Sub

Private Sub Command3_Click()
'On Error Resume Next
If Me.Tag = "" Then
 MsgBox "Please select data to delete", vbCritical, "Crud"
Else
Set rstUserAcct = New ADODB.Recordset
    If rstUserAcct.State = 1 Then rstUserAcct.Close
    rstUserAcct.Open "Select * from tblInfo where ID like'" & Me.Tag & "'", MyConn, adOpenDynamic, adLockBatchOptimistic
    rstUserAcct.Delete
    rstUserAcct.UpdateBatch
    data
    MsgBox "Successfully Deleted", vbInformation, "DELETE"
    Me.Tag = ""
End If
End Sub

Private Sub Form_Activate()
data
End Sub

Sub data()
On Error Resume Next
Dim lst
Dim cnt As Integer
Dim X As Integer
Set rstUserAcct = New ADODB.Recordset
    If rstUserAcct.State = 1 Then rstUserAcct.Close
    rstUserAcct.Open "Select * from tblInfo", MyConn, adOpenDynamic, adLockBatchOptimistic
    
With Me.Listview1
    .ColumnHeaders.Clear
    .ListItems.Clear
    .ColumnHeaders.Add , , "", 0
    .ColumnHeaders.Add , , "USERNAME", 3000
    .ColumnHeaders.Add , , "PASSWORD", 4000
    .ColumnHeaders.Add , , "FISTNAME", 4000
    .ColumnHeaders.Add , , "MIDDLENAME", 4000
    .ColumnHeaders.Add , , "LASTNAME", 4000
End With
Do Until rstUserAcct.EOF
    Set lst = Listview1.ListItems.Add(, , rstUserAcct.Fields!ID)
        lst.ListSubItems.Add , , rstUserAcct.Fields!UserName
        lst.ListSubItems.Add , , rstUserAcct.Fields!Password
        lst.ListSubItems.Add , , rstUserAcct.Fields!firstname
        lst.ListSubItems.Add , , rstUserAcct.Fields!middlename
        lst.ListSubItems.Add , , rstUserAcct.Fields!lastname
  cnt = cnt + 1
rstUserAcct.MoveNext
Loop
Label1.Caption = "Total No. of record(s): " & cnt
End Sub


Private Sub Form_Unload(Cancel As Integer)
End
End Sub


Private Sub Listview1_Click()
Me.Tag = Me.Listview1.selectedItem.Text
End Sub

Download the complete source code for more information about the system. You can contact me @
Email – larrydaveemol@gmail.com

Let me know what you need just leave a message/comment and I will do my very best to make that happen. I hope this codes will help you. Enjoy Coding!

Categories
Visual Basic 6.0

Limit Login Attempts

In this program you’ll learn how to lock an account after 3 times attempts that put a wrong password in Vb6 using MSAccess….

Create form to your project and double click the form to enter the code window Copy the code below and paste then save it.

Private Sub Command1_Click()
On Error Resume Next
Static count As Integer
 Set rstUserAcct = New ADODB.Recordset
    If rstUserAcct.State = 1 Then rstUserAcct.Close
    rstUserAcct.Open "Select * from tblInfo where Username = '" & Text1.Text & "'", MyConn, adOpenDynamic, adLockBatchOptimistic
    
    If Me.Text1.Text = "" Then
    MsgBox "Enter Username", vbInformation, "Username"
    Me.Text1.SetFocus
    Exit Sub
    End If
    
    If Me.Text2.Text = "" Then
    MsgBox "Enter Password", vbInformation, "Password"
    Me.Text2.SetFocus
    Exit Sub
    End If
    
    If rstUserAcct.RecordCount = 0 Then
    MsgBox "Username not found", vbInformation, "Username"
    Exit Sub
    End If
           
    If rstUserAcct.Fields!Locked = True Then
    MsgBox "Password is Lock", vbInformation, "Contact Administrator"
    Exit Sub
    End If
            
If rstUserAcct.Fields("Password") = Text2.Text Then
            
                Unload Me
                Mainform.Show
                
Else
MsgBox "Invalid Password!", vbExclamation, "Sample App"
count = count + 1
Me.Tag = count
            If Me.Tag = 1 Then
                Me.Label2.Caption = "2 Attempts"
            ElseIf Me.Tag = 2 Then
                Me.Label2.Caption = "1 Attempts"
            ElseIf Me.Tag = 3 Then
                rstUserAcct.Fields!Locked = True
                rstUserAcct.UpdateBatch
            End If
End If
End Sub

Download the complete source code for more information about the system. You can contact me @
Email – larrydaveemol@gmail.com

Let me know what you need just leave a message/comment and I will do my very best to make that happen. I hope this codes will help you. Enjoy Coding!

Categories
Visual Basic 6.0

Catch Duplicate Entry

This is a simple program to check and create a method that searches duplicate entry in the table, if it doesn’t exist insert it, otherwise, give a Return statement.

 Option Explicit

Public Function AppDir() As String
    If Right$(App.Path, 1) = "\" Then
        AppDir = App.Path
    Else
        AppDir = App.Path & "\"
    End If
End Function

Public Sub SQLDB(adoObj As Adodc, AdoRec As String) 'for SQL Recordsource

    'Loads the database and provides the database password
    adoObj.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & AppDir & "Tutorial.mdb;Persist Security Info=False;Jet OLEDB:Database Password = "
    
    'Sets the command type to Table
    adoObj.CommandType = adCmdText
    
    'Loads the source table of info
    adoObj.RecordSource = AdoRec

    'refreshes database status
     adoObj.Refresh
End Sub
 Private Sub Command1_Click()
    If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Then
        msgbox.Caption = "? Please complete the data fields"
    Else
        Call SQLDB(Me.AdoCon, "SELECT * From tblinfo where FIRSTNAME like'" & Me.Text1.Text & "' and MIDDLENAME like'" & Me.Text2.Text & "' and LASTNAME like'" & Me.Text3.Text & "'")
        If Me.AdoCon.Recordset.RecordCount = 1 Then
        msgbox.Caption = "? Duplicate Entry" & " " & Me.Text1.Text & " " & Me.Text2.Text & " " & Me.Text3.Text & " " & Me.Tag
        Exit Sub
        End If
        
        Call SQLDB(Me.AdoCon, "Select * From tblInfo")
          With Me.AdoCon.Recordset
                  .AddNew
                  .Fields(1) = Text1.Text
                  .Fields(2) = Text2.Text
                  .Fields(3) = Text3.Text
                  .Fields(4) = Text4.Text
                 .Update
           End With
           Me.Text1.Text = ""
           Me.Text2.Text = ""
           Me.Text3.Text = ""
           Me.Text4.Text = ""
    End If
End Sub

For more information about the system. You can contact me @
Email – larrydaveemol@gmail.com

Let me know what you need just leave a message/comment and I will do my very best to make that happen. I hope this codes will help you. Enjoy Coding!

Categories
Visual Basic 6.0

SELECT DISTINCT Statement

In this sample codes, you will learn to create select distinct statement in VB6 programming and MSAccess with the help of examples. SELECT DISTINCT display only distinct or different values it will not display in duplicate records.

Option Explicit

Public Function AppDir() As String
    If Right$(App.Path, 1) = "\" Then
        AppDir = App.Path
    Else
        AppDir = App.Path & "\"
    End If
End Function

Public Sub SQLDB(adoObj As Adodc, AdoRec As String) 'for SQL Recordsource

    'Loads the database and provides the database password
    adoObj.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & AppDir & "Tutorial.mdb;Persist Security Info=False;Jet OLEDB:Database Password = "
 
    'Sets the command type to Table
    adoObj.CommandType = adCmdText
 
    'Loads the source table of info
    adoObj.RecordSource = AdoRec

    'refreshes database status
     adoObj.Refresh
End Sub
Private Sub Form_Load()
Call SQLDB(Me.AdoCon, "select distinct Namex from tblInfo Order by Namex")
If Not (Me.AdoCon.Recordset.EOF And Me.AdoCon.Recordset.BOF) Then
Combo1.Clear
Do While Not Me.AdoCon.Recordset.EOF
    Combo1.AddItem Me.AdoCon.Recordset.Fields("Namex").Value
    Me.AdoCon.Recordset.MoveNext
    Combo1.ListIndex = 0
    Loop
 End If
End Sub

For more information about the system. You can contact me @
Email – larrydaveemol@gmail.com

Let me know what you need just leave a message/comment and I will do my very best to make that happen. I hope this codes will help you. Enjoy Coding!

Categories
Visual Basic 6.0

Get Year, Quarter and Month in VB6

This sample codes will display Year, Quarter and Month written in VB6.
First, you have to add the component: Microsoft Windows Common Controls-2 5.0 (SP2) Or Microsoft Windows Common Controls-2 6.0 (SP4), depending on the version you have, use MonthView control.

Create form to your project and double click the form to enter the code window Copy the code below and paste then save it.

Private Sub Form_Activate()
Me.lblY.Caption = Me.MonthView1.Year
Me.MonthView1.Value = Date
Me.Caption = Me.MonthView1.Month
If Me.Caption = "1" Or Me.Caption = "2" Or Me.Caption = "3" Then
    Me.lblQ.Caption = "1st Quarter"
ElseIf Me.Caption = "4" Or Me.Caption = "5" Or Me.Caption = "6" Then
    Me.lblQ.Caption = "2nd Quarter"
ElseIf Me.Caption = "7" Or Me.Caption = "8" Or Me.Caption = "9" Then
    Me.lblQ.Caption = "3rd Quarter"
ElseIf Me.Caption = "10" Or Me.Caption = "11" Or Me.Caption = "12" Then
    Me.lblQ.Caption = "4th Quarter"
End If
End Sub

For more information about the system. You can contact me @
Email – larrydaveemol@gmail.com

Let me know what you need just leave a message/comment and I will do my very best to make that happen. I hope this codes will help you. Enjoy Coding!