Edit Article

Edited by Fndungu83, Teresa, Carolyn Barratt, Gaurang and 2 others

Many people have tried to find a way to link their vb projects with databases but not many have succeed. One best way is to use the Microsoft data access object.

Ad

EditSteps

  1. 1
    Make your forms in vb 6.0 and make sure the display is attractive.
    Ad
  2. 2
    Design a database and make sure you put all necessary tables.
  3. 3
    Then from the forms you just created make sure you have the main form which will be used as the main user interface
  4. 4
    Select the form you want to connect to the database, lets say the form have three fields namely: name, country and telephone.
  5. 5
    Your form should also have a save button so that when you click at it then users will be able to save the information on the database.
  6. 6
    Make a list of the following.
    • Your database name e.g people.mdb.
    • Your table name e.g register.
  7. 7
    Then from your form double click the "saving button" on the form.
  8. 8
    Insert the following information on the coding space
    • dim dbpeople as database
    • dim dbregister as recordset
    • set dbpeople=opendatabase("app.path & /People.mdb")
    • set tblregister=dbpeople.openrecordset("register")
    • tblregister.addnew
    • tblregister!name=txtname.text
    • tblregister!country=txtcountry.text
    • tblregister!telephone=txttelephone.text
    • tblregister.update
    • msgbox "Your record was successfully saved."
  9. 9
    Then go to tools references and add a reference to Microsoft Data access object -locate it and move it to the first priority using the up arrow.
  10. 10
    Now run your form and enter the details.
  11. 11
    Click on save and the contents of the forms will be put on the database.
  12. 12
    Remember to put the database in the same folder you have saved your project.
    Ad
Add your own method
Save

Article Info

Categories: Visual Basic | Operating Systems

Recent edits by: DaisyDoo, Gaurang, Carolyn Barratt

Ad

Thanks to all authors for creating a page that has been read 2,491 times.

Was this article accurate?

YesNo

Contribute
to wikiHow!

Edit this article