Results 1 to 2 of 2

Thread: Vb + Ms Db

  1. #1
    Join Date
    Apr 2004

    Unanswered: Vb + Ms Db


    Ok I have a Excel Spread Sheet with about 15k shops on it. Boss wants me to make a Access DB that one of our reps can take with him to conventions ect.. He wants to be able to just search the DB and return a list of Shops that he searched for.

    Now I know I can build the DB to do this but It would be nicer to have a VB program to just pull the information from the DB. Any one have a site that might help me do this?

    Does not have to be fancy.

    I have already imported the files from the Excel sheet into Access. Is there a site that would eplain how to link the 2 in Visual Basic?

  2. #2
    Join Date
    Mar 2004

    Re: Vb + Ms Db

    Here is some code to connect to an Access database, reterive data from Table1, close the recordset and close the connection using VB with ADO.

    Dim cn as ADODB.Connection
    Dim rs as ADODB.Recordset

    Set cn = new ADODB.Connection
    cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Test.mdb;Persist Security Info=False"

    set rs = new ADODB.recordset
    rs.ActiveConnection = cn
    rs.Open "SELECT * FROM Table1"

    Set rs=Nothing
    Set cn = Nothing

    You will need to

    1) Create your form
    2) Add a reference to the Microsoft ActiveX Data Objects library
    3) Create some labels and textboxes to your forms and bind them.
    4) Look at the links in my signature for a data control that will let you navigate, add new, delete, search, refresh, undo and save changes to your recordsets just by dropping the control on the form.

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts