can someone help me to identify what is wrong with my code? i recheck and recode it many times as possible but still cant figure out the one error. it doesnt run.

Recommended Answers

All 7 Replies

error only in the part of cnn.Open ~~~

try this

        Dim Connection As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source='" & "your path" & "';" & "Persist Security Info=False;" & "Jet OLEDB:Database Password=" & "your pass" & ";")
        Connection.Open()

but i used adodb connection coz thats what our instructor taught us. Is it really required to use that Oledb Connection?

Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset

cnn.Open("DBQ=C:\Users\Regina\Documents\Bank.accdb;Driver={Microsoft Access Driver (*.mdb, *.accdb )};uid=;pwd=;")

sorry, my bad.
your code is working fine..but i think that you are working on 64bit computer.
for your code to work you need to choose X86 platform
Build - Configuration Manager - Active Solution platform - new - new platform select X86

The driver name has a space in the name that should not be there. Remove the space after *.accdb.

Change driver from:

Driver={Microsoft Access Driver (*.mdb, *.accdb )};

To:

Driver={Microsoft Access Driver (*.mdb, *.accdb)};

Also dont forget to uid=USERNAME;pwd=PW;")

thanks for the help guys :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.