rocky_enc
07-26-2010, 01:21 PM
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.
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.