Go Premium for a chance to win a PS4. Enter to Win

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

Problem with MS Access

Can anyone tell me what I should be looking for when I get an error message "[Microsoft][ODBC Microsoft Access Driver] Internal OLE Automation Error"

This appears only in my executable not in the design environment and appears to happen with this code

Set tmpRecordset = New ADODB.Recordset
TmpSQL = "SELECT USER_LOGIN_NAME, USER_LOCKED FROM Users"
TmpSQL = TmpSQL & " WHERE USER_LOCKED = TRUE"

tmpRecordset.Open TmpSQL, sConnection, adOpenKeyset,adLockOptimistic

0
mutrus
Asked:
mutrus
  • 3
  • 3
  • 2
  • +4
1 Solution
 
xSinbadCommented:
How about Dim tmpRecordset as New ADODB.Recordset instead of Set tmpRecordset = New ADODB.Recordset.


Cheers
Marcus
0
 
cjzone81Commented:
Did u test ur connection string for the sConnection u declare?
0
 
RemCommented:
Looks like a bad entry in the registry to me.
If I were you, I'd try to unregister msado15.dll (for ADO activex control 2.7) and re-register it.

Marcus, I guess mutrus has a global declaration for the ADODB.recordset, and therefor uses the Set syntax.

cizone81, mutrus wouldn't have the same error message, and besides, his program wouldn't run in tne design environment.

C U

Rem
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
clanglCommented:
I think REM is right, OLE automation error... I would start with the dll or maybe the version of MDAC you are using and if you are using a form check the components you are using.  I know I had the same problem awhile ago but it was when I was exporting a bunch of data to an Excel Worksheet
0
 
rkot2000Commented:
try to use this to create a recordset :
dim tmpRecordset as ADODB.Recordset
Set tmpRecordset = CreateObject("ADODB.Recordset")

this may give you a better error.


to xSinbad  - it's bad idea to declare something with new.

0
 
Richie_SimonettiCommented:
Just a guess:
Try with
Set tmpRecordset = New ADODB.Recordset
TmpSQL = "SELECT USER_LOGIN_NAME, USER_LOCKED FROM Users"
TmpSQL = TmpSQL & " WHERE USER_LOCKED =" & BooleanValue

Where BooleanValue is a boolean variable True or False
0
 
xSinbadCommented:
>to xSinbad  - it's bad idea to declare something with new.

I personally would not use new either but that is what mutrus was doing. I personally would never use ADO but that is not for me to tell others what to do. If mutrus wants to use Dim tmpRecordset as ADODB.Recordset then that is also an option.

Regards
Marcus
0
 
cjzone81Commented:
Marcus,i always use this when i try to connect to the database.
dim rst as adodb.recordset
'this is on top of the page

set rst = new adodb.recordset
'n i'll use this to create an instance when i need to store data anywhere in the page.
'n i'll close it too whenever i've finished using it.

but why is it bad to declare something with new?
n just now u said u will not use the ADO,why?
what other option did u turn to?
0
 
RemCommented:
The keyword New is optional. It enables implicit creation of an object. If you use New when declaring the object variable, a new instance of the object is created on first reference to it, so you don't have to use the Set statement to assign the object reference.
xSinbad: are you still using RDO?  LOL

Bye

Rem
0
 
mutrusAuthor Commented:
Thanks guys thats something to look at.

Yes the recordset is declared globally.

One other thing thought. I'm sorry that I forget to mention it but the error does not occur with the exe file on the same PC as the design environment. It happens on the clients PC.

Also it appears that I'm not using msado15.dll (ADO ActiveX 2.7) but ActiveX 2.1 which uses msado21.tbl - how do I register/unregister this (if its possible). This is my first attempt at writing VB with database access so much of what I'm using come from looking at other peoples apps.

0
 
RemCommented:
How did you install your exe on the other machine?
Did you just copy the exe, or did you use the deployment wizard shipped with VB?
If you did use the deployment wizard, did you include the mdac, or at least the libraries you used to access the database in your project?

btw the usage of regsvr32.exe :
regsvr32 /u thedllyouwanttoUNregister
regsvr32 thedllyouwanttoregister

Bye

Rem
0
 
mutrusAuthor Commented:
I did initially copy the exe file as the target pc already has the vb development app which I had already used for my app and so the required files were there. I followed your suggestion though and used the deployment wizard which when run gave me an error that there was a problem with regestering msado21.tlb. I then uninstalled my app, changed to msado15.dll and reinstalled it using the installation package. This appeared to re-install the MDAC and now it all works. Thanks everyone
0
 
xSinbadCommented:
cjzone81 I always use DAO instead of ADO. Just my preference.

Cheers
0

Featured Post

Independent Software Vendors: 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!

  • 3
  • 3
  • 2
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now