473,405 Members | 2,141 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,405 software developers and data experts.

I cut this example right out-a-the MS Access 2.0 help. I cannot get it to work.

MLH
If I substitute one of my own tables into the 4th line,
the code shown below still fails on that same line
at runtime. Any ideas why?

Sub Button0_Click ()
Dim MyDB As Database, MyTable As Recordset
Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set MyTable = MyDB.OpenRecordset("Products", DB_OPEN_TABLE)
MyTable.Index = "Supplier ID"
Do Until MyTable.NoMatch
MyTable.Seek "=", 1
If Not MyTable.NoMatch Then
MyTable.Edit
MyTable("Supplier ID") = 2
MyTable.Update
End If
Loop
MyTable.Close

End Sub
xxxxxxxxxx Bottom of Code Snippet xxxxxxxxxxxx

Here's the error message I get...
Invalid operation.

Possible causes:

You tried to write to a read-only property. See the Usage
section of the Help topic for the property to determine whether or not
it's read write.
You tried to use a method or property on a type of Recordset
object that the method or property doesn't apply to. See the
Recordset Object,
Recordsets Collection - Summary topic to determine which methods and
properties apply to a given type of Recordset object.
You tried to append a property to a Properties collection of
an object that doesn't support user-defined properties.


Nov 13 '05 #1
5 1368
MLH
I failed to mention that the table on which I was operating
was an attached table in a frontend/backend setting. I have
had this problem before and am uncertain whether it has been
resolved.
Nov 13 '05 #2
MLH wrote:
I failed to mention that the table on which I was operating
was an attached table in a frontend/backend setting. I have
had this problem before and am uncertain whether it has been
resolved.


You cannot use DB_OPEN_TABLE on a linked table. Use DB_OPEN_DYNASET.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
Nov 13 '05 #3
You can't treat an attached table as table type recordset.

Either
Open as a dynaset and ditch the seek
Or
change the line
Set MyDB = DBEngine.Workspaces(0).Databases(0)
to open the db the table is in
e.g.
Set MyDB = OpenDatabase("Path to the table containing db")

--
Terry Kreft
MVP Microsoft Access
"MLH" <CR**@NorthState.net> wrote in message
news:h3********************************@4ax.com...
I failed to mention that the table on which I was operating
was an attached table in a frontend/backend setting. I have
had this problem before and am uncertain whether it has been
resolved.

Nov 13 '05 #4
MLH
Thanks, Terry. I really like the latter option. That way, I
can use the SEEK method. That's a great idea! You are
a genius!
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

You can't treat an attached table as table type recordset.

Either
Open as a dynaset and ditch the seek
Or
change the line
Set MyDB = DBEngine.Workspaces(0).Databases(0)
to open the db the table is in
e.g.
Set MyDB = OpenDatabase("Path to the table containing db")


Nov 13 '05 #5
MLH <CR**@NorthState.net> wrote in
news:aa********************************@4ax.com:
You can't treat an attached table as table type recordset.

Either
Open as a dynaset and ditch the seek
Or
change the line
Set MyDB = DBEngine.Workspaces(0).Databases(0)
to open the db the table is in
e.g.
Set MyDB = OpenDatabase("Path to the table containing db")


Thanks, Terry. I really like the latter option. That way, I
can use the SEEK method. That's a great idea! You are
a genius!


Why in the world do you need to use SEEK?

SEEK will only give a performance advantage when you *must* open the
entire table for navigation, and you need to jump around within that
table to locate data.

In the vast majority of cases, you need a particular value or set of
records, and in that case, it's vastly easier to use a dynaset and
use a WHERE clause to restrict the records returned to just what you
need. If you have multiple records, you can navigate with
..FindFirst/.FindNext. That operation is slower than SEEK, but
because save time (and resources) because you've retrieved far fewer
rows in the first place -- the net result is the same or faster than
the SEEK. Or, at least, it's close enough to make it not worth the
trouble of using SEEK.

I, for one, have never once used a SEEK, ever, in 10 years of Access
programming. Not even one time. And I can't think of a single
real-world scenario in any of the dozens of apps I've created where
SEEK would offer any kind of advantage that would be worth the
trouble of using it.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #6

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

Similar topics

0
by: tcarvin | last post by:
This is going to sound stupid, but I can't get the help to work in the Visual Studio .NET. I've tried using the help that comes with Studio and also from the MSDN. All I get is a generic...
7
by: Paul T. Rong | last post by:
Hi everybody, I can not add into the "order_detail" subform a product more than once. The subform just refuses accepting any repeated items. The subform's source is a "expanded_order_detail"...
4
by: MLH | last post by:
Access 97 has left examples out of much of HELP that was included in Access 2.0. Anybody know why? Or better still, where to find examples. For example, Access 97 has no example code in its...
3
by: news.giganews.com | last post by:
Does anyone know if there's an easy way to export or copy the relationship structure from one mdb to a new one? The relationships in the db are time consuming to reproduce. I am trying to make a...
4
by: Charts | last post by:
6/23/05 ..NET Development\Framework\dotnet.framework.aspnet Visual Studio 2005 Beta 2 project cannot work in IIS virtual directory I used Visual Studio 2005 Beta 2 to build a simple new...
2
by: Bruce Russell | last post by:
This may sound stupid but I can't rename the WebForm1.aspx in the solution explorer. The file is located in my local web server at C:\Inetpub\wwwroot\Lab3-VB-Starter\WebForm1.aspx Is there...
7
by: zhong.zx | last post by:
I need to expand the DOM object function for conviniency as following: Node.prototype.removeChildren = function() { while( this.lastChild) this.removeChild( this.lastChild); } which can be...
2
by: JRamirez | last post by:
Need help cannot figure out where I made the error. -------------------------------------------------------------------------------- Can someone view what I have, I need help I cannot figure out...
1
by: web20tester | last post by:
Hi all, I am new to javascript. I have this script working fine in IE but cannot work in firefox. Really appreciate on any guidance. search0.js function Search(str) { var...
1
by: sprasad123 | last post by:
Need bit of a help with Access to SQL subform queries i have upsized a Access DB. It also has a Access frontend. The upsized went ok. I relinked the Access linked table to SQL. When I try to add a...
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: 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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.