473,394 Members | 1,812 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,394 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 5254
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...

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.