473,399 Members | 4,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

DAO or ADO in an MDE data base?

Hi,
I am using Access2000 and have developed a data base which successfully uses
DAO code in some of the forms to update tables.
Recently I converted the data base to a split MDE data base and now get
errors in the DAO methods.
IE:
Dim Rst As DAO.Recordset
Set Rst = CurrentDb.OpenRecordset("TableName")
Rst.Index = "IndexName"

The code halts at the last line above with the error message "Operation not
supported by this type of object"

Should the DAO code work on an MDE data base or should I be using ADO code.

Paul Copeland
Nov 12 '05 #1
4 5255
On Tue, 16 Sep 2003 22:05:46 GMT in comp.databases.ms-access, "Paul
Copeland" <pa***@ngbrown.com.au> wrote:
Hi,
I am using Access2000 and have developed a data base which successfully uses
DAO code in some of the forms to update tables.
Recently I converted the data base to a split MDE data base and now get
errors in the DAO methods.
IE:
Dim Rst As DAO.Recordset
Set Rst = CurrentDb.OpenRecordset("TableName")
Rst.Index = "IndexName"

The code halts at the last line above with the error message "Operation not
supported by this type of object"

Should the DAO code work on an MDE data base or should I be using ADO code.


ADO would not support that even on the local tables. The DAO method
you're using only works for tables in the database that you're working
in, not attached tables, you need to open the backend database first,
e.g.

Dim db As database, rs as recordset

set db = dbengine(0).opendatabase("c:\foo\bar\mydata.mdb")
set rs=db.openrecordset("TableName")
rs.index="IndexName"
....
rs.close
set rs=nothing
db.close
set db=nothing

Remember this is a database object you will have to close since you
opened it.

--
A)bort, R)etry, I)nfluence with large hammer.

(replace sithlord with trevor for email)
Nov 12 '05 #2
Thanks Trevor,
Are you saying that the DAO code as I have used is restricted to local
database applications i.e. .mdb files as the code in my posting does work on
my .mdb file without error.
If I wish to split my database so I can have a number of users accessing
the one database file on a server do I need to modify my code as per your
example. If this is the case how do I get around the fixed reference
opendatabase("c:\foo\bar\mydata.mdb") in your "set db" statement as this
means the location of the database files are hard coded in VB? Not very
flexible.
Paul Copeland

"Trevor Best" <bouncer@localhost> wrote in message
news:s2********************************@4ax.com...
On Tue, 16 Sep 2003 22:05:46 GMT in comp.databases.ms-access, "Paul
Copeland" <pa***@ngbrown.com.au> wrote:
Hi,
I am using Access2000 and have developed a data base which successfully usesDAO code in some of the forms to update tables.
Recently I converted the data base to a split MDE data base and now get
errors in the DAO methods.
IE:
Dim Rst As DAO.Recordset
Set Rst = CurrentDb.OpenRecordset("TableName")
Rst.Index = "IndexName"

The code halts at the last line above with the error message "Operation notsupported by this type of object"

Should the DAO code work on an MDE data base or should I be using ADO
code.
ADO would not support that even on the local tables. The DAO method
you're using only works for tables in the database that you're working
in, not attached tables, you need to open the backend database first,
e.g.

Dim db As database, rs as recordset

set db = dbengine(0).opendatabase("c:\foo\bar\mydata.mdb")
set rs=db.openrecordset("TableName")
rs.index="IndexName"
...
rs.close
set rs=nothing
db.close
set db=nothing

Remember this is a database object you will have to close since you
opened it.

--
A)bort, R)etry, I)nfluence with large hammer.

(replace sithlord with trevor for email)

Nov 12 '05 #3
No, the problem is that use of the seek command,a nd the index command is a
very old legacy command. It is a throwback to the old dbase/dos days.

You can use dao freely, but use of seek on linked tables requires some
special coding. There is a work around for this problem here:

http://www.mvps.org/access/tables/tbl0006.htm
Note that seek does not work on sql server, or in fact for odbc connections
to any other database. It should be avoided. However, it has VERY high
performance, so don't be too quick to not use it!
--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
ka****@msn.com
http://www.attcanada.net/~kallal.msn
Nov 12 '05 #4
On Wed, 17 Sep 2003 01:56:35 GMT in comp.databases.ms-access, "Paul
Copeland" <pa***@ngbrown.com.au> wrote:
Thanks Trevor,
Are you saying that the DAO code as I have used is restricted to local
database applications i.e. .mdb files as the code in my posting does work on
my .mdb file without error.
If I wish to split my database so I can have a number of users accessing
the one database file on a server do I need to modify my code as per your
example. If this is the case how do I get around the fixed reference
opendatabase("c:\foo\bar\mydata.mdb") in your "set db" statement as this
means the location of the database files are hard coded in VB? Not very
flexible.


It need not be a fixed reference but a variable, you can even get the
path from the .Connect property of the table, useful if you attach
tables from different back-ends simultaneously. (you'll need to strip
off the ";DATABASE=" bit from the front.

--
A)bort, R)etry, I)nfluence with large hammer.

(replace sithlord with trevor for email)
Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Alexander Kervero | last post by:
Hi ,today i was reading diveinto python book,in chapter 5 it has a very generic module to get file information,html,mp3s ,etc. The code of the example is here :...
3
by: Daniel Graifer | last post by:
Why doesn't c++ support virtual data? It supports class data of type pointer to function (that's what virtual functions really are). In terms of implementation, why can't I have other types of...
7
by: Zaharije Pasalic | last post by:
I tried to implement multi-data list with a reference instead of pointer to data, but code compiled with gcc perform "segmentation fault". Generated code from other compilers: Borland C++ 5.0 and...
28
by: Act | last post by:
Why is it suggested to not define data members as "protected"? Thanks for help!
2
by: Vicente Nicolau | last post by:
Hello I'm making a PDA project that uses a data base. That data base is saved in a xml file. When the application starts up, I load the xml file in memory. The application makes changes in the...
5
by: Lloyd Dupont | last post by:
I'm attempting to write a fairly complex data structure. One part of the complexity is that all 8 data operations it supports delegate some code to virtual method. This is by design because I...
7
by: atomik.fungus | last post by:
Hi, im having problems compiling some code, and i dont understand why. I've made a Matrix class for any kind of data and now im implementing an inherited class with all the mathematical stuff...
3
by: nandhanvijay | last post by:
hi every am trying to connect data base in vb.net but am unable to connect. As per the book am following that says to connect to data base go to tools menu connect to data base option. u will...
5
by: ElTipo | last post by:
Hello People, I made a data base with secure wizard to provide to users a PID and Passwords. I need to extract data from Crystal Reports 7 in this data base but Crystal Reports send me a message...
6
by: Immortal Nephi | last post by:
First class is the base class. It has two data: m_Base1 and m_Base2. Second class and third class are derived classes and they are derived from first class. m_Base1 and m_Base2 are inherited into...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.