Solved

Problem with MS Access

Posted on 2002-04-15
13
232 Views
Last Modified: 2010-05-18
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
Comment
Question by:mutrus
  • 3
  • 3
  • 2
  • +4
13 Comments
 
LVL 6

Expert Comment

by:xSinbad
ID: 6943908
How about Dim tmpRecordset as New ADODB.Recordset instead of Set tmpRecordset = New ADODB.Recordset.


Cheers
Marcus
0
 

Expert Comment

by:cjzone81
ID: 6944117
Did u test ur connection string for the sConnection u declare?
0
 
LVL 3

Expert Comment

by:Rem
ID: 6944180
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
 

Expert Comment

by:clangl
ID: 6944489
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
 
LVL 5

Expert Comment

by:rkot2000
ID: 6944801
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
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6944903
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 6

Expert Comment

by:xSinbad
ID: 6946281
>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
 

Expert Comment

by:cjzone81
ID: 6946723
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
 
LVL 3

Expert Comment

by:Rem
ID: 6947032
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
 

Author Comment

by:mutrus
ID: 6947290
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
 
LVL 3

Accepted Solution

by:
Rem earned 100 total points
ID: 6947304
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
 

Author Comment

by:mutrus
ID: 6948912
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
 
LVL 6

Expert Comment

by:xSinbad
ID: 6949227
cjzone81 I always use DAO instead of ADO. Just my preference.

Cheers
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now