6 Replies - 674 Views - Last Post: 20 August 2017 - 12:50 PM Rate Topic: -----

#1 Anjali Agrawal  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-August 17

problem in opening connection string

Posted 16 August 2017 - 08:07 AM

Dim con As New ADODB.Connection 
Dim rs As New ADODB.Recordset Dim str As String 

then many more lines
there then comes
Private Sub Form_Load() con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Admin\Documents\ProfileDB.accdb" 
rs.Open "Select * from ProfileTBL", con, adOpenDynamic, adLockPessimistic . 


i am getting an error where i am opening connection string .. error says unrecognised database format ..
please help ...
please let me know asap..
thank you

Is This A Good Question/Topic? 0
  • +

Replies To: problem in opening connection string

#2 andrewsw  Icon User is offline

  • the case is sol-ved
  • member icon

Reputation: 6376
  • View blog
  • Posts: 25,763
  • Joined: 12-December 12

Re: problem in opening connection string

Posted 16 August 2017 - 08:11 AM

You need ACE 12 for an Access 2007+ file, not Jet 4.
Was This Post Helpful? 0
  • +
  • -

#3 Anjali Agrawal  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-August 17

Re: problem in opening connection string

Posted 16 August 2017 - 08:53 AM

con.Open "Provider=Microsoft.Ace.OLEDB.4.0;Data Source=C:\Users\Admin\Documents\ProfileDB.accdb"


is this what you wanna say ?
if yes , then let me tell you that it also comes with an error "provider not found , it may not be properly installed "
please reply
thank you

This post has been edited by andrewsw: 16 August 2017 - 11:08 AM
Reason for edit:: Removed previous quote, just press REPLY

Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is offline

  • the case is sol-ved
  • member icon

Reputation: 6376
  • View blog
  • Posts: 25,763
  • Joined: 12-December 12

Re: problem in opening connection string

Posted 16 August 2017 - 11:11 AM

Note that you don't have to quote your original post, use the Reply button further down the page.

Do not guess at what the connection string might be. Look it up. connectionstrings.com

You may also need to install the Ace 12.0 provider.
Was This Post Helpful? 0
  • +
  • -

#5 Anjali Agrawal  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-August 17

Re: problem in opening connection string

Posted 16 August 2017 - 11:51 AM

How to download that ?
Can u please tell me..
Thank u
Was This Post Helpful? 0
  • +
  • -

#6 andrewsw  Icon User is offline

  • the case is sol-ved
  • member icon

Reputation: 6376
  • View blog
  • Posts: 25,763
  • Joined: 12-December 12

Re: problem in opening connection string

Posted 16 August 2017 - 12:39 PM

Is the internet down? Try searching "download ace 12 provider".

But I would make sure that you have the correct, exact, connection string first. This should hopefully provide a more meaningful error message. If, on the other hand, it works, then you already have the provider.
Was This Post Helpful? 0
  • +
  • -

#7 gibra  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 18-June 17

Re: problem in opening connection string

Posted 20 August 2017 - 12:50 PM

View PostAnjali Agrawal, on 16 August 2017 - 08:07 AM, said:

Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset

Private Sub Form_Load() con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Admin\Documents\ProfileDB.accdb"


First, Download Microsoft Access Database Engine 2016 Redistributable from Official Microsoft Download Center
https://www.microsof...s.aspx?id=54920

Dim strDBPath As String
strDBPath = "C:\Users\Admin\Documents\ProfileDB.accdb"

Dim con As ADODB.Connection 
Set con = New ADODB.Connection 
con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strDBPath & "; Persist Security Info=False;"
con.Open
con.CursorLocation = adUseClient

Dim rs As ADODB.Recordset 
Set rs = New ADODB.Recordset 
rs.Open "Select * from ProfileTBL", con, adOpenDynamic, adLockPessimistic


:bigsmile:/>
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1