connecting vb and ms access tutorial

Upload: varundaga2007

Post on 05-Apr-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 Connecting VB and MS Access Tutorial

    1/10

    1 Email:[email protected]

    Connecting VB Application and MS AccessIn 4 easy Steps

    1. Make a database suitable for yourApplication

    2. Make ODBC Driver for your database

    3. Add ADODC Control to Your VBApplication

    4. Connect your ADODC with the TextBoxesThis is a chain Process, Should be followed one after another

  • 8/2/2019 Connecting VB and MS Access Tutorial

    2/10

    2 Email:[email protected]

    Make a Microsoft Access Database with Required Columns tostore Data from your Application and save it.(remember the tablename)

    Now we have to make ODBC Driver for Database. Follow theseSteps.

    Go to > > >

    Now Click on Add Button

    1

    2

  • 8/2/2019 Connecting VB and MS Access Tutorial

    3/10

    3 Email:[email protected]

    Select (*.mdb ,*.accdb)Because we are using MS Access

    .mdb & .accdb are the Extensions for the Access 2003 and Access 2007 file** In Windows 7 this option may not be there, Scroll down to last page to see what to do in this situation

    But the remaining steps are same.

    1. Select the Database you made for Application.2. Give some name for your Database ODBC Driver. (Here apple is our ODBC DriverName)3. Click OK.

  • 8/2/2019 Connecting VB and MS Access Tutorial

    4/10

    4 Email:[email protected]

    Now we are done with Making ODBC Driver for Our Database.

    1. Make a database suitable for your Application2. Make ODBC Driver for your database3. Add ADODC Control to Your VB Application4. Connect your ADODC with the Text Boxes

    Now remaining steps need to be performed inside Visual Basic 6.0Now Get into Visual Basic

    Project > Components (Ctrl + T)

    Tasks to be done outside VB

    Tasks to be performed inside VB

    3

  • 8/2/2019 Connecting VB and MS Access Tutorial

    5/10

    5 Email:[email protected]

    Now Check the Tool Box a new tool is added

    Drag and drop this tool into your Form.

  • 8/2/2019 Connecting VB and MS Access Tutorial

    6/10

    6 Email:[email protected]

    Now connect this Adodc1 with the ODBC Driver we made.1. Click on Adodc1.2. Check the Properties of Adodc1 in the Right hand side of Screen.3. Two Properties of Adodc1 need to Changed ( Connection String & RecordSource ).

    apple is the name of the ODBC Driver we made.

    Click Here

  • 8/2/2019 Connecting VB and MS Access Tutorial

    7/10

    7 Email:[email protected]

    Our Database is Connected through ODBC Driver and ADODC ,Now weneed to Specify the Table name we made in Access, Suppose the tablename is Table1The table name is to specified in the RECORDSOURCE property of Adodc1.1. Click on Adodc1.2. Check the Properties of Adodc1 in the Right hand side of Screen.

    Click Here

  • 8/2/2019 Connecting VB and MS Access Tutorial

    8/10

    8 Email:[email protected]

    See the Table names are appearing in the List. Select the required tableMeans 50% of Connection is Successful.

    Now our database is indirectly connected to Adodc14

    2

  • 8/2/2019 Connecting VB and MS Access Tutorial

    9/10

    9 Email:[email protected]

    Now we have connect the text boxes with the Adodc1

    1.Select the Text Box2.Check the Properties of the textbox in the Right hand side.3.Two Properties to be changed here. ( Data Source and Data Field )

    1. DataSource : Adodc name2. DataField : Column name

    First set the DataSource name then Datafield

  • 8/2/2019 Connecting VB and MS Access Tutorial

    10/10

    10 Email:[email protected]

    1.

    2.

    If your connection is 100% correct then this list of Columns will appearfrom your table.

    Assign the Particular Column name to the respective Text Box& thats all, similarly do same thing for the remaining textboxes

    -----------------------------END----------------------------ODBC Driver for Windows 7 (32 bit & 64 bit)

    Follow the following path to get compatible ODBC Driver.C:\Windows\winsxs\x86_microsoft-windows-m..-odbc-administrator_31bf3856ad364e35_6.1.7600.16385_none_44263d819f0aa19e

    Or , Go to C:\Windows\winsxs and search for file odbcad32This tutorial assumes Reader have basic Knowledge of VB 6.0 and MS Access

    For any Feedback / Suggestions / queries or to say Hi mail me [email protected]/varundaga2007

    mailto:[email protected]:[email protected]:[email protected]:[email protected]