473,396 Members | 1,942 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,396 software developers and data experts.

Problem editing data in queries

I was wondering if anybody could help me with the following... which is related I think to my question here
http://www.thescripts.com/forum/thread780631.html

I have two queries which are based on three tables - q1 is based on t1 and t3, q2 is based on q2 and q3. Each table has the fields {HID, yr, mo} and then some data fields. Each has {HID, yr, mo} as the primary key.

The two queries are structurally identical, with the following SQL:

Expand|Select|Wrap|Line Numbers
  1. SELECT t1.HID, t1.yr, t1.mo, t1.somedata1, ..., ..., t3.somedatax
  2. FROM t1 INNER JOIN t3 ON (t1.mo = t3.mo) AND (t1.yr = t3.yr) AND (t1.HID = t3.HID);
The problem is that I can sometimes only open one of the queries for editing, and the other one is locked for editing, but then sometimes, the other one is editable and the other is not. Would anybody be able to tell me (a) why this might be, and (b) how I can work around it?
Mar 11 '08 #1
6 1283
DLN
26
It has been my experience that Inner Joins will cause this problem.

I don’t know of a work around, except don’t use an Inner Join.
Mar 11 '08 #2
dbpros
15
It may be the joins... Do all your tables have primary keys?

http://www.db-pros.com
Mar 11 '08 #3
DLN
26
I looked in my Access 2000 book and it says
The following properties of a query prevent you from appending and updating records.

The Unique Values property is set to Yes in the query properties window.

Self-Joins are used in the query.

Access SQL aggregate functions, such as Sum(); are employed in the query.
Crosstab queries, for example, use SQL aggregate functions.

No Primary-key fields with a unquie (No Duplicates) Index exist for the one table in a one-to-many relationship.
Mar 11 '08 #4
Thank you for your ideas...

@dbpros - yes, all the tables have primary keys.

@DLN - none of the reasons your book suggests for not being able to update records match in my case. Unique values is set to no; I don't know what self joins are, but if they're what they sound like, I haven't used them (and you can check the SQL above); there are no aggregate functions in the SQL; each table has a primary key defined.

You suggest avoiding inner joins - how would I do this?


If anybody has any more ideas I'd be very grateful - I'm tearing my hair out at this seemingly pathological behaviour from Access.
Mar 11 '08 #5
Stewart Ross
2,545 Expert Mod 2GB
Thank you for your ideas...

@dbpros - yes, all the tables have primary keys.

@DLN - none of the reasons your book suggests for not being able to update records match in my case. Unique values is set to no; I don't know what self joins are, but if they're what they sound like, I haven't used them (and you can check the SQL above); there are no aggregate functions in the SQL; each table has a primary key defined.

You suggest avoiding inner joins - how would I do this?

If anybody has any more ideas I'd be very grateful - I'm tearing my hair out at this seemingly pathological behaviour from Access.
Hi. In my experience Access table joins behave soundly, and the behaviour you describe is not in any way normal or routine. I would be checking two things: firstly, that the relationships between tables is defined appropriately, with referential integrity on and cascade updates set, and secondly, that the key fields from the joined tables in your misbehaving query are included from the one-side of the relationships and not the many-side.

We would need to see the actual SQL (or at least a suitable extract which includes all the joins, and all the key fields) and an extract from the field structure of the underlying tables to give an informed opinion of what could be wrong.

Inner joins - otherwise known as equi-joins - cannot of themselves cause such problems. Without equi-joins SQL as we know it could not function at all and you should not try to avoid them.

The only times I have ever had unexplained behaviour with updatable queries has been when I have not taken the key query fields from the 1-side tables. I have production databases in daily use, both single-user and multi-user, and this just does not arise in a fully-relational table structure with relationships set correctly from the start.

Although Access is not perfect (what is?) and has known bugs it simply does not behave randomly when it comes to table joins.

-Stewart
Mar 11 '08 #6
DLN
26
Hi. In my experience Access table joins behave soundly, and the behaviour you describe is not in any way normal or routine. I would be checking two things: firstly, that the relationships between tables is defined appropriately, with referential integrity on and cascade updates set, and secondly, that the key fields from the joined tables in your misbehaving query are included from the one-side of the relationships and not the many-side.

-Stewart
I got to thinking about this last night and you're right, the problems I had in the past with inner-joins had to do with the one-to-many relationships.
Mar 12 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: NewBob | last post by:
Since Access automatically highlights all of the text in a text control (I use it to hold data from a memo field) when the control is activated, I've added the following code to put the cursor at...
3
by: Michael Plant | last post by:
Hello one and all. I have a stored table in my database and the form I'm using is based on a query that draws data from my stored table and a linked table. The linked table is a *.txt file. ...
10
by: Saso Zagoranski | last post by:
hi, this is not actually a C# problem but since this is the only newsgroup I follow I decided to post my question here (please tell me where to post this next time if you think this post...
1
by: loosecannon_1 | last post by:
Hello everyone, I am hoping someone can help me with this problem. I will say up front that I am not a SQL Server DBA, I am a developer. I have an application that sends about 25 simultaneous...
3
by: Juan Antonio Villa | last post by:
Hello, I'm having a problem replicating a simple database using the binary log replication, here is the problem: When the master sends an update to the slave, an example update reads as follows:...
1
by: greg | last post by:
I have a table that I want to left join with crosstab query and I want to be able to edit data in the table (only). However, once I perform the join, the entire query result cannot be edited. Is...
4
by: helenwheelss | last post by:
Access 2003, using a bound form. I'm seeing rather annoying behaviour when editing data in a control with a default value. It only happens when the form is on a new record. A specific...
14
by: cjakeman | last post by:
Hi, Solved a little mystery yesterday when I built a form that combined 2 tables with a 1:M relationship and relational integrity. All the correct data was visible on the form but, if I tried to...
10
prn
by: prn | last post by:
Hi all, Among other things, I maintain an Access application that I have inherited from about a half-dozen previous maintainers. :( I got a call from one of the users to the effect that one of...
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
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.