By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,293 Members | 1,382 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,293 IT Pros & Developers. It's quick & easy.

objConnection.Open without file path?

P: 40
Hello!
I have this code:
Expand|Select|Wrap|Line Numbers
  1. Const adOpenStatic = 3
  2.     Const adLockOptimistic = 3
  3.  
  4.     Set objConnection = CreateObject("ADODB.Connection")
  5.     Set objRecordSet = CreateObject("ADODB.Recordset")
  6.  
  7.     objConnection.Open _
  8.         "Provider=Microsoft.Jet.OLEDB.4.0; " & _
  9.             "Data Source=i:\db.mdb"
Is there some way to connect to database without entering filepath as Data Source?
Aug 6 '07 #1
Share this Question
Share on Google+
1 Reply


P: 8
I'm kind of new to Access, but this is how I do it (after linking to my backend tables).

Public cn As ADODB.Connection
Public rs As ADODB.Recordset

Set cn = CurrentProject.AccessConnection
Set rs = New ADODB.Recordset

Set rs.ActiveConnection = cn
Dec 6 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.