Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tables not forming a relationship properly
Message
 
 
To
16/07/2003 09:57:08
Brian Weber
Ohio Department of Development
Columbus, Ohio, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00810631
Message ID:
00810638
Views:
17
First, defaulting a PK field to the recno() is a very bad idea. The reason is if you delete records, then pack the table, you could get errors when a new record is added because the recno() of the new record probably already exists in an older record. For example add 6 records and you have PK values of 1 through 6. Delete any record except record #6 and pack. You now have 5 records. The next record added will be recno 6. You already have a record whose PK is 6.

In the child table, you need a PK field and a Foreign Key [FK] integer field. This FK field will contain the value equal to the PK value of its parent record in the parent table.

>I'm still a little new to FoxPro, and having issues linking tables together. I have two tables, set up with an appropriate automaticly defined primary key(numerical field, with a default value of "recno()" ), and FoxPro wont let me create any relationship between the two table except a one to one relationship, which is not what i want, and besides that it doesnt work right. I need a one to many relationship. On top of this, FoxPro is working just fine pulling data from the one table, yet will only pull one record from the other(its not updating the form at all), despite the query changing for both tables. Im not sure really how to explain it clearly, but thats the best way to describe it i can come up with. Any suggestions on how to fix this would be welcome
> Brian
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform