I'm having problem updating a form that queries from 3 tables. When I
update the foreign key it tries to update the PK on the foreign key
table which it shouldn't. I'm using MS Access 2003 connected to SQL
Server 2000.
Here's an example:
Tables: T1, T2, and T3.
T1 links to T2, and T2 links to T3.
When I update the foreign key on T1 that links to T2, MS Access is
trying to update the PK of T2, instead of the foreign key of T1 which
causes data integrity error "cannot update PK on T2". T1 are the main
contents of the form. When the foreign key changes the form should also
be updates with the foreign table information.
Thanks in advance,
Benjamin 14 1922
Note, All tables are 1:1 relationship. It is normalized.
Here's an example:
select T1.*, T2.Field1, T3.Field1
from (T1 inner join T2 on T1.T2ID = T2.ID) inner join T3 on T2.T3ID =
T3.ID
I dont' understand why it would update the T2.ID, when I update T1.T2ID
field. Is this a bug in MS Access? or could I specify which table to
update somewhere?
Thanks,
Benjamin
Do you have cascade updates turned on in the relationship between the
two tables?
Jeremy
--
Jeremy Wallace http://metrix.fcny.org
Should the cascade update be implemented on the SQL Server side? I see
the option on MS Access, but the options are disabled. BTW, I'm using
MDB with linked-tables, not ADP.
But it's tring to update T2.ID instead of the foreign key field on
T1.T2ID.
Thanks,
Ben
Let me clarify on the relationships:
T1 is 1:1 to T2, and T2 is *:1 to T3. There could be cases where T2 is
*:1 to other tables.
When I take T3 out of the picture it still does the same thing.
On the SQL Server side, I tried having the relationship:
* With and Without "Enforce relationship for INSERTs and UPDATEs"
* With and without "Cascade Update Related Fields"
Neither one works... MS Access is trying to update the identity column
of the T2, it should update T1.T2ID (foreign key column). It's weird
that it does that because in the select statement it doesn't have
T2.ID, it has the T1.ID (of the T2) which I named T1.T2ID in this
example. I wonder if that's the problem.
Hmm... Here's a more real example:
I have T1.T2ID (Foreign Key), and T2.T2ID (PK). I update T2ID on the
form, the form queries from T1.T2ID only, it doesn't selected from
T2.T2ID. When it updates, it updates T2.T2ID which is the problem. It
should update T1.T2ID. Hmmm... Maybe if I rename the foreign key column
on T1.T2ID to T1.fkT2ID it might work... I'll give that a shot.
That didn't work... renaming column T1.T2ID to T1.fkT2ID didn't work...
It's still trying to update T2. Here's the error message:
ODBC--update on a linked table 'T2' failed.
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot update
identity column 'T2ID'. (#8102)
It shouldn't update T2.T2ID.... It should update T1.fkT2ID ... that
didn't work....
Am I missing something here? I created a ADP and connect directly to
the SQL Server, created a view with those queries, and I was able to
update the T1.T2ID without any problem. But... I cannot use ADP yet, I
need to develop under MDB... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dreamerw7 |
last post by:
Hi,
I know this is probably a dumb question, but here goes:
I have 3 tables:
REGION
REG_ID
REGION
|
by: Frank |
last post by:
We have an Access database Sch_S.mdb in the shared driver S across the
network. I have a copy of that database in my local driver C, named as
Sch_C.mdb. As per users' request I added some check boxes in the main
form of the database, and added some relevant subroutines in that form.
Now I need to put the modified database Sch_C.mdb to the shared S
driver. Since new data had been added to tables (say T1, T2) in
Sch_S.mdb while I was...
|
by: gthompson |
last post by:
Is this possible:
Read fields(rows/columns) from one sql database table (TableA). Then edit/update the same 'field' in TableA; and in TableB edit/update a different field - all at the same time?
This is the current situation in an Access Form using Sql for the backend. We would like to convert this Access Form to a Web Form using Visual Studio.net and VB.net.
Please help. Thanks,
gthompson
|
by: mpmason14 |
last post by:
i want to update my "timesheet" form based upon a second form "add employee" whenever a new employee is added. right now the "add employee" form adds the employee to the table, but it doesn't update the form to show the new employee unless i close the "timesheet" form and reopen it.
any ideas how to get the "timesheet" form to automatically update with the new records when i close the "add employee" form?
thanks
|
by: EyesFriedOpen |
last post by:
I was trying to post this to the IBM DB2 forum, however I do not have the "New Post" button available when I view the IBM DB2 forum. Therefore, I apologize if this is not the right place for this.
I need some help writing a single IBM DB2 v8 SQL statement to do an UPDATE, please. I need to be able to UPDATE 2 different tables based on some criteria without writing a stored procedure. I am trying to do an UPDATE such that IF some criteria...
| |
by: Robert Bravery |
last post by:
HI all,
Can someone show me or point me to a place where I can find out how to
update dbase(dbf) tables.
Thanks
RObert
|
by: MyWaterloo |
last post by:
Heya...
Thanks in advance if you can help... or at least understand my gibberish.
I have 2 tables, let's call them tblBacT and tblBacTData, they are related through the auto number primary key "entryId" in tbleBacT. I have created a form (frmBacT) and sub form (subfrmBacTData) with the sub from in columnar view. Kiddie stuff right? My problem is: I don't want the user to be able to enter data in the sub form and then exit or move on to...
|
by: koskap |
last post by:
Hello . I have three related tables (Team, driver, points).
The problem that i have is that i can't update all three tables at the same time. The error says that a record is required in the table team. I use Access and VB.2008
Thanks
|
by: Big P |
last post by:
I need to update a form everytime a button is clicked.
My form has more than 20 buttons.
So need i to find out what is the best event to do that.
I am new to VB Express and now i have the time to explore something new.
Tks for your help.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |