Link vb6 with Ms Access by using ADO

I fail to link vb6 with ms Access by using ADO

Page 1 of 1

1 Replies - 14377 Views - Last Post: 05 January 2009 - 09:00 AM Rate Topic: -----

#1 tumbo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 05-January 09

Link vb6 with Ms Access by using ADO

Post icon  Posted 05 January 2009 - 05:50 AM

The following below are the codes which I used to connect vb with the Ms Access
but when I'm trying to run I got error(Run-time error'-2147467259(80004005)Could not find installable ISAM)

Private Sub cmdsave_Click()
Dim conn As New ADODB.Connection, str As String
Dim rs As New ADODB.Recordset

str = "DataSouce=" & App.Path & "\mant.mdb"
conn.Provider = "Microsoft Jet 4.0 OLE DB Provider"
conn.ConnectionString = str
conn.Properties("Jet OLEDB:Database Password") = "ment"
conn.Open
rs.Open "select * from ment", conn, adOpenDynamic, adLockOptimistic
rs.AddNew
rs(0) = Text2.Text
rs(1) = Text1.Text
rs(2) = cbodist.Text
rs(3) = Text3.Text
rs(4) = Text4.Text
rs(5) = Text5.Text
rs(6) = Text6.Text
rs.Save
conn.Close
rs.Close

End Sub



Mod Edit: Please use code tags when posting your code. Code tags are used like so => :code:

Thanks,
PsychoCoder :)

Is This A Good Question/Topic? 0
  • +

Replies To: Link vb6 with Ms Access by using ADO

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1659
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Link vb6 with Ms Access by using ADO

Posted 05 January 2009 - 09:00 AM

First try the modifications I made to your code and see if it changes anything

Private Sub cmdsave_Click()
    Dim conn As New ADODB.Connection, str As String
    Dim rs As New ADODB.Recordset
    
    str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="" & App.Path & ""\mant.mdb;User Id=YourUsername;Password=ment;"
    conn.Open str
    
    rs.Open "select * from ment", conn, adOpenDynamic, adLockOptimistic
    rs.AddNew
    rs(0) = Text2.Text
    rs(1) = Text1.Text
    rs(2) = cbodist.Text
    rs(3) = Text3.Text
    rs(4) = Text4.Text
    rs(5) = Text5.Text
    rs(6) = Text6.Text
    rs.Save
    conn.Close
    rs.Close
End Sub



Be sure to change YOurUsername to your actual username. If that doesnt solve your problem check out this Microsoft KB and see if that helps :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1