[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 258
  • Last Modified:

DSN Less Connection Code

I am trying to execute this code from a module in MS Access 2003:

Option Compare Database



Public Sub DSNLESS()
Dim m_rdoConn As rdoConnection
Dim m_rdoErr As rdoError
Dim m_rdoResult As rdoResultset
Dim m_rdoEnv As rdoEnvironment
Dim m_rdoCol As rdoColumn

Set m_rdoEnv = rdoEnvironments(0)
Set m_rdoConn = m_rdoEnv.OpenConnection(dsname:="", _
                prompt:=rdDriverComplete, _
                Connect:="uid=Hawk_User;pwd=Hawk33y3;driver={SQL Server};" _
                & "server=MSSQLCLPROD01;database=HAW;")


End Sub

I am receiving a message: "Runtime error 429 - ActiveX Component can not create object".

What am I missing?
0
Kirkeous
Asked:
Kirkeous
1 Solution
 
rockiroadsCommented:
dont know if u suffer from the design time licence problem

http://support.microsoft.com/kb/194751/

0
 
leclairmCommented:
If you're using rdo, you need to have mdac 2.5 or below installed.  Why would you want to develop with this considering it is now obselete????

You should switch to ado and install a later version of mdac.

For your reference:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmdac/html/data_mdacroadmap.asp
0
 
leclairmCommented:
<If you're using rdo, you need to have mdac 2.5 or below installed>

Forget that part, I wrote it thinking of something else.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
inthedarkCommented:
Microsoft recommend using a UDL file to test your connection.

http://support.microsoft.com/?kbid=264691

Basically create a blanmk text file rename it like MyData.udl, then double click on the file and the UDL Wizzard kicks in.

Once you have selected a Provider, MS Acces for example, then complete the rest of the details.  You get a Test Connection button so you can prove you can open your database without have to write one line of code, or even think.

Once you have a UDL file you can open it and copy and paste the connection string into your application.

One cute thing is to leave the UDL file in place and open it with code. (Warning its is a unicode file so you may need to convert from unicode.)  Then using instr you can find the connection string. This means you can relocate your data without changing/recompiling code.

If you are using SQL Server or security enabled databases, another trick is to place a token where the password is like $$PASSWORD$$ you can replace the token withing the string for the correct password.

So now you have a connection string you know will work you can start to code.

As suggested above you need to swap to use ADO.  But as ADO is about 2000% slower and less reliable than DAO many people are staying with DAO.
0
 
KirkeousAuthor Commented:
Yes, we did have license issue. Now it is fixed and I can use ADO so I am good. Thanks for your help! though!
0
 
rockiroadsCommented:
Kirkeous, u said u had a license issue. My initial post mentioned that possibility. Did it help u or not?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now