vb code to access database - help reqd.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BalaC
    New Member
    • Apr 2008
    • 2

    vb code to access database - help reqd.

    Hi,

    Some time ago a friend's friend showed me a sample project to access the tables in MS Access directly through vb code. I couldn't see any ADO control on any of the forms. The ActiveX Objects library was however included in the project references.
    I tried to do the same thing on my own with a trial project using the Northwind database, but failed. I get the following error messages: connection is closed or the object is not found or method not found.

    I included the following statements like him in the project.

    Under General declarations:
    [CODE=VB]
    Option Explicit
    Public conXYZ as ADODB connection

    Under Formload:

    Private Sub Form_Load()

    Set conXYZ = New Connection
    conXYZ.CursorLo cation = adUseClient


    conXYZ.Open "Driver={Micros oft Access Driver(*.mdb)}; DBQ=C:\Test.mdb ;UID=admin;PWD= testdb;"
    End Sub


    where test.mdb is a copy I made of of the northwind database.
    Unfortunately I have lost touch with the guy. Can any one help?[/CODE]
    Last edited by Dököll; Apr 4 '08, 04:30 AM. Reason: [CODE=VB] tag...
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Originally posted by BalaC
    Hi,

    Some time ago a friend's friend showed me a sample project to access the tables in MS Access directly through vb code. I couldn't see any ADO control on any of the forms. The ActiveX Objects library was however included in the project references.
    I tried to do the same thing on my own with a trial project using the Northwind database, but failed. I get the following error messages: connection is closed or the object is not found or method not found.

    I included the following statements like him in the project.

    Under General declarations:
    [CODE=VB]
    Option Explicit
    Public conXYZ as ADODB connection

    Under Formload:

    Private Sub Form_Load()

    Set conXYZ = New Connection
    conXYZ.CursorLo cation = adUseClient


    conXYZ.Open "Driver={Micros oft Access Driver(*.mdb)}; DBQ=C:\Test.mdb ;UID=admin;PWD= testdb;"
    End Sub


    where test.mdb is a copy I made of of the northwind database.
    Unfortunately I have lost touch with the guy. Can any one help?[/CODE]
    You have the markings of s skilled programmer, if this is your code. I actually have no clue. I must say though I have just posted a code in DAO I think might be helpful:



    Dököll
    Last edited by Dököll; Apr 4 '08, 04:33 AM. Reason: added link:-)

    Comment

    • BalaC
      New Member
      • Apr 2008
      • 2

      #3
      What does the highlighted word 'subscribed' at the bottom of the posting mean? -Bala

      Comment

      Working...