Consulting

Results 1 to 2 of 2

Thread: con.open error message data source name not found no default driver specified

  1. #1

    con.open error message data source name not found no default driver specified

    I am trying to create a simple vb form using visual basic application which can connect to ms access database and insert data into the database. I have already tried the following code which was working fine but then I upgrade to ms office 2010 trial package and I think it was working that time as well but then suddenly one day I started getting the following error

    Run-time error '-2147467259 (80004005)';

    [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

    once I came across this error I removed ms office 2010 but still the error was there

    the code I used is as follows


    Private Sub CommandButton1_Click()

    Dim conn As New ADODB.Connection
    Dim connectionstr As String
    Dim sql As String

    connectionstr = "DBQ=C:\Users\Shan\desktop\sample.mdb; driver={Microsoft Access Driver(*.mdb)};"

    conn.Open connectionstr

    sql = "insert into table1 values('" & textbox1.value & "','" & textbox2.value & "')"

    conn.Execute sql
    conn.Close
    Set conn = Nothing

    End Sub

    I know this coding is absolutely fine as it was working before but it would be greatfull if anyone can solve this problem.

  2. #2
    VBAX Expert
    Joined
    Feb 2005
    Location
    Nanaimo, British Columbia, Cananda
    Posts
    568
    Location
    Cheers,

    dr

    "Questions, help and advice for free, small projects by donation. large projects by quote"

    http:\\www.ExcelVBA.joellerabu.com

Posting Permissions

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