ibiubu Posted April 1, 2002 Posted April 1, 2002 Years ago I built a database using relationships...As I recall it was between 4 database files. I have not had a use to do this for quite a while. Currently I have a database file I am using. I have built a new database lfie with a layout for custom reporting purposes. It wll get the data from my existing database. From what I remembered I have to have 2 similiar fields in eash database. In this case I have went with a ID Number field. In the databases. These fields are set to do an auto number+1 entry each time a record is created. All I really want the new Report database to do is flow along with the Maste databaser. In other words, if I create a new record in the Master, a new one is created in the Reporting database. If I delete a record in the Master database, it is deleted in the Report database. When I first set up the Relationship; 1) from which database do I do this. Do I set up the relationship from the Report database linking to the Master database, or vice versa. 2) I thought that when I first set up the relationship that if I picked the ID Number field from the 2 databases, select the create and delete options, this would do it. But when I create a new record in the Master database, no new record is created in the Report database. If I delete one from the Master, of coursse there is nothing to delete from the the Report database. What is it that I am missing?
michele Posted April 1, 2002 Posted April 1, 2002 You can't expect database 'B' to follow database 'A' by itself (unless you do some scripting) But you can add a record to database 'B' related to database 'A' a through a portal. Create a field in database 'B' which is called "fk_A" (=foreign key of database A). Create a relationship with your key field in database "A": Keyfield A = fk_A Put a portal in your database A based on this relationship and check: "allow the creation of related records" for this portal. Now everytime you enter data in the portal the key field of 'A' will automatically be entered in the field 'fk_A' in database 'B'. A related record is created. If you check: 'when deleting a record in this file also delete related records' in the 'define relationships' window. Related records in database 'B' will automatically be deleted if you remove a record from database 'A'. I hope this makes some sense to you...
Recommended Posts
This topic is 8329 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now