I'm finding this to be extremely difficult to set up. I understand
that Access won't manage the primary key and the cascade updates for a
table. Fine. I tried changing the PK type to number and setting
default value to a UDF that manages the auto-numbering. Access won't
take a UDF as a default value. Okay, I'll use SQL WITHOUT any
aggregate functions, for the default value. Access won't do that
either. Okay, I create a second column, make it autonumber and PK,
then set the default value of my old PK column to the field value of
the new autonumber PK field. Wow! Access won't do that either. Am I
crazy or should this be easier? Any insight will be greatly
appreciated.
MS Access 2002
Windows XP Pro
Thanks,
Lee
Nov 12 '05
33 4317
Lee Cichanowicz wrote: You have clearly identified problem, Bas: No triggers in Access! What a tremendous shortcoming...I mean, product feature, that is.
There are *some* triggers but that is of no use to the programmer.
Cascase update and delete must be trigger-powered; autonumber itself is
some sort of trigger.
--
Bas Cost Budde http://www.heuveltop.org/BasCB
but the domain is nl
"Lee Cichanowicz" <ci***********@ hotmail.com> wrote: But why? As it says below: Line items can be reassigned to other requisitions. All I want is to be able to change the ReqID (currently an autonumber) of an existing line item and have Access cascade update the related tables.
>This is an existing database, which I didn't design: Requisitions have >line items. Line items can be reassigned to other requisitions. All >I want is to be able to change the ReqID (currently an autonumber) of >an existing line item and have Access cascade update the related >tables.
But this sounds like ReqID is a foreign key and not the primary key. Surely the ReqID is a primary key in the Requesition Header table. But it would be a foreign key in the Line Item table.
Yep. Precisely.
But the LineItem table in which you need to change ReqID has it's own autonumber key
which is not ReqID. Likely LineItemID if I follow the naming system implied. Thus
ReqID in the Line Item table is not an autonumber key in which case you should be
able to change it just fine. And without affecting any child tables such as Line
Item Funding.
tblRequisition s --> tblLineItems --> tblLineItemFund ing --> tblUnitAccepta nce ...
Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at http://www.granite.ab.ca/accsmstr.htm
Ah, yes. Right you are. :] I actually need both (update the PK and the
FK) at times, but I'll take what I can get.
Thanks,
Lee
"Tony Toews" <tt****@teluspl anet.net> wrote in message
news:83******** *************** *********@4ax.c om... "Lee Cichanowicz" <ci***********@ hotmail.com> wrote:
But why? As it says below: Line items can be reassigned to other requisitions.
AllI want is to be able to change the ReqID (currently an autonumber) of an existing line item and have Access cascade update the related tables.
>This is an existing database, which I didn't design: Requisitions have >line items. Line items can be reassigned to other requisitions. All >I want is to be able to change the ReqID (currently an autonumber) of >an existing line item and have Access cascade update the related >tables.
But this sounds like ReqID is a foreign key and not the primary key. Surely the ReqID is a primary key in the Requesition Header table. But it would
be aforeign key in the Line Item table.
Yep. Precisely.
But the LineItem table in which you need to change ReqID has it's own
autonumber key which is not ReqID. Likely LineItemID if I follow the naming system
implied. Thus ReqID in the Line Item table is not an autonumber key in which case you
should be able to change it just fine. And without affecting any child tables such
as Line Item Funding.
tblRequisition s --> tblLineItems --> tblLineItemFund ing --> tblUnitAccepta nce ...
Tony
-- Tony Toews, Microsoft Access MVP Please respond only in the newsgroups so that others can read the entire thread of messages. Microsoft Access Links, Hints, Tips & Accounting Systems at http://www.granite.ab.ca/accsmstr.htm
It seems impossible to make all of this happen in the back-end mdb, though.
Or is it? I think the only work around for this is to change the data type on the field from AutoNumber to Long. You'll need to create you own function to generate new numbers, but your update queries should then be capable of changing your IDs
-- Mike Storr veraccess.com
"Mike Storr" <st******@sympa tico.ca> wrote in message
news:9w******** *************** *****@40tude.ne t... On 7 Feb 2004 14:55:45 -0800, Lee C. wrote:
I'm finding this to be extremely difficult to set up. I understand that Access won't manage the primary key and the cascade updates for a table. Fine. I tried changing the PK type to number and setting default value to a UDF that manages the auto-numbering. Access won't take a UDF as a default value. Okay, I'll use SQL WITHOUT any aggregate functions, for the default value. Access won't do that either. Okay, I create a second column, make it autonumber and PK, then set the default value of my old PK column to the field value of the new autonumber PK field. Wow! Access won't do that either. Am I crazy or should this be easier? Any insight will be greatly appreciated.
MS Access 2002 Windows XP Pro
Thanks, Lee
"Lee Cichanowicz" <ci***********@ hotmail.com> wrote... It seems impossible to make all of this happen in the back-end mdb,
though.
Correct.
Or is it?
It is impossible, given the way that Access/Jet is being [mis]used here.
Though perhaps one could look at doing a proper schema redesign as soon as
feasible (the facts that (1) a table can exist with *no* candidate keys, and
(2) an autonumber is being used as data points to at least two of those
flaws. The flaws are what in fact leads up to being unable to do what one
wants to in a file server database product).
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies
This posting is provided "AS IS" with
no warranties, and confers no rights.
I saw it as wanting to misuse a feature (tirggers) that would have
legitimate uses, if it existed. ;] I think well-designed Access databases
are too uncommon; I rarely get to work on them, anyway. I also rarely get
to design. I get called in to fix them after they are so far along that the
client feels that they have too much invested to start over. I'm pretty low
on the food chain, so I just do what I'm told: fix the messed up database in
XX hours, or less.
Personally, I don't like surrogate keys at all. I wish Access didn't have
autonumber, but that likely wouldn't force people to design tables with good
natural keys--they'd just simulate autonumber in VBA. :[
Thanks for your insight.
"Michael (michka) Kaplan [MS]" <mi*****@online .microsoft.com> wrote in
message news:40******@n ews.microsoft.c om... "Lee Cichanowicz" <ci***********@ hotmail.com> wrote...
It seems impossible to make all of this happen in the back-end mdb, though.
Correct.
Or is it?
It is impossible, given the way that Access/Jet is being [mis]used here. Though perhaps one could look at doing a proper schema redesign as soon as feasible (the facts that (1) a table can exist with *no* candidate keys,
and (2) an autonumber is being used as data points to at least two of those flaws. The flaws are what in fact leads up to being unable to do what one wants to in a file server database product).
-- MichKa [MS] NLS Collation/Locale/Keyboard Development Globalization Infrastructure and Font Technologies
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lee Cichanowicz" <ci***********@ hotmail.com> wrote: I saw it as wanting to misuse a feature (tirggers) that would have legitimate uses, if it existed. ;] I think well-designed Access databases are too uncommon; I rarely get to work on them, anyway. I also rarely get to design.
Whereas designing new database has been pretty much all I've been doing for years.
Personally, I don't like surrogate keys at all. I wish Access didn't have autonumber, but that likely wouldn't force people to design tables with good natural keys--they'd just simulate autonumber in VBA. :[
There are definite arguments for having good natural keys. However I tried this once
and found that
1) Access doesn't do a good job with these. In particular subforms and other places
where wizards are expecting only one field for a key they get really confused with
multiple fields in the key.
That said this was back in A2.0. That said Tom Ellison has done an excellent job of
promoting natural keys elsewhere and I think he said that the wizards still don't do
a good job.
2) sometimes when you got down enough tables you started having many fields in the
primary keys. It got to be quite cumbersome in the relationships diagram.
3) It is extra work when doing record inserts via VBA,ec.
4) You're right about the simulating of autonumber in VBA. <smile>
5) Hey, even SQL Server has identity keys. <smile>
6) Personal preference is that I like the simplicity of autonumber keys.
Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at http://www.granite.ab.ca/accsmstr.htm
"Lee Cichanowicz" <ci***********@ hotmail.com> wrote: Ah, yes. Right you are. :] I actually need both (update the PK and the FK) at times, but I'll take what I can get.
Ah, good.
But now we're back to why would you need to update the PK?
Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at http://www.granite.ab.ca/accsmstr.htm
Bas Cost Budde <ba*@heuveltop. org> wrote in
news:c0******** **@news2.solcon .nl: Lee Cichanowicz wrote: You have clearly identified problem, Bas: No triggers in Access! What a tremendous shortcoming...I mean, product feature, that is.
There are *some* triggers but that is of no use to the programmer. Cascase update and delete must be trigger-powered; autonumber itself is some sort of trigger.
Um, no, it's not.
AutoNumber is a special kind of default value.
Nothing more, nothing less.
--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Answer: Design.
Even so, I don't understand the horror of the idea of changing a primary key
value on occassion. Access lets you do it for all field types other than
Autonumber, right? As long as you're using cascade update, what's the big
deal? As long as the value is still unique, and the change gets propagated
throughout related tables, I don't see a dilemma. Granted, if it's being
done a lot, it would seem to indicate a less than ideal PK choice.
, Lee
"Tony Toews" <tt****@teluspl anet.net> wrote in message
news:ib******** *************** *********@4ax.c om... "Lee Cichanowicz" <ci***********@ hotmail.com> wrote:
Ah, yes. Right you are. :] I actually need both (update the PK and the FK) at times, but I'll take what I can get.
Ah, good.
But now we're back to why would you need to update the PK?
Tony -- Tony Toews, Microsoft Access MVP Please respond only in the newsgroups so that others can read the entire thread of messages. Microsoft Access Links, Hints, Tips & Accounting Systems at http://www.granite.ab.ca/accsmstr.htm This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ed_No_Spam_Please_Weber |
last post by:
Hello All & Thanks in advance for your help!
Background:
1) tblT_Documents is the primary parent transaction table that has 10
fields and about 250,000 rows
2) There are 9 child tables with each having 3 fields each, their own
PK; the FK back to the parent table; and the unique data for that
table. There is a one to many relation between the parent and each of
the 9 child rows. Each child table has between 100,000 and 300,000
|
by: serge |
last post by:
I have a scenario where two tables are in a One-to-Many relationship
and I need to move the data from the Many table to the One table so
that it becomes a One-to-One relationship.
I need to salvage the records from the many table and without going
into detail, one of the reasons I can't do the opposite as
there are records in the ONE table that I need to keep even if they
don't have any child records in the MANY table.
Below I created...
|
by: Jon Earle |
last post by:
Hi,
Had a problem with PsotgreSQL v7.3.4. I had a table that, after a while,
decided to give me a fit:
db=> insert into blocklist values ('2', 'km4n7s28ehiFizeYupm93Q',
'1','2','3');
ERROR: Index idx_blk_id_addr is not a btree
When I deleted and recreated the table, it worked fine. Any ideas?
|
by: PAUL |
last post by:
Hello,
I have 2 tables with a relationship set up in the dataset with vb
..net. I add a new record to the parent table then edit an existing child
record to have the new parent ID. However when I do the update the changed
parentid in the child table fails to change. No error is given its just that
the change is not written to the Database.
When I step through the records for the child table the one I would expect
to be changed has a row...
|
by: Robert Fitzpatrick |
last post by:
I am running PostgreSQL 7.4.5 and have a trigger on a table called
tblriskassessors which inserts, updates or delete a corresponding record
in tblinspectors by lookup of a contact id and license number match. The
INSERT and DELETE work fine. The UPDATE works good unless I update the
license number. The error, at the bottom of this message, suggests the
primary key violation. But my UPDATE in no way alters the primary key,
which is...
| |
by: FreeToGolfAndSki |
last post by:
Hi,
I have an Orders Table that has Employee1 and Employee2 (one is the
sales rep the other is the telemarketing rep) Both of these fields
need to cascade update against the Employees table. I can't seem to
create the desired relationship in a Diagram and I'm not sure how best
to set this up. Any ideas?
Thanks in advance...
|
by: polocar |
last post by:
Hi,
I'm writing a program in Visual C# 2005 Professional Edition.
This program connects to a SQL Server 2005 database called
"Generations" (in which there is only one table, called
"Generations"), and it allows the user to add, edit and delete the
various records of the table.
"Generations" table has the following fields:
"IDPerson", NamePerson", "AgePerson" and "IDParent".
A record contains the information about a person (his name, his...
|
by: adithi |
last post by:
My Table Structure is:
Table A Table B Table C
colA -PK Col B-PK Col C-PK
Col B-FK Col B-FK
Col C-FK
This relation establish a Concurrent relation where in Cascade Property fails.I can set Cascade property for any two tabnles...but not the third table.
My requirement is :
|
by: klarae99 |
last post by:
Hello,
I am working in Access 2003 to create a database to record information about an annual fundraiser. I was hoping someone could review my table structure and make sure that it is normalized correctly and that it is set up to do what I would like it to do. I have some doubts on my current table structure and I would really appreciate any suggestions for improvement before I move on to creating my data entery forms.
The purpose of...
|
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: 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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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: 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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: 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...
| |