UtterAccess.com
Thank you for your support!      
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> FK relationship?    
 
   
oryon122
post Jul 17 2006, 12:29 PM
Post #1

UtterAccess Addict
Posts: 102
From: IL, USA



Good day forumites,

I have a form, used for entry and editing, bound to a query comprised of the following tables -

tbl1 = DID (PK), Date, EID, LID and DAID
tbl2 = DAID (PK), DailyAssign
tbl3 = EID (PK), Last, First, Middle, ESID
tbl4 = ESID (PK), Status
tbl5 = VHID (PK), DID, Hours

My form is Continuous, which I believe prevents me from using a subform to solve this problem (??)

My problem exists between the DID PK of table 1 and the DID FK in table 5. I would like for the number generated as the PK in table 1 to be saved as the FK in table 5 when Hours are entered into a record. The PK relationship to the FK is one-to-many. When I enter a new "record" into the form it generates a new record in table 1 and if I enter Hours it generates a new record in table 5 but does not populate the DID (FK) field. Thus when I want to view or access this data it does not show up because the DID match does not exist. I run into this sort of problem periodically and generally find a way around it, but I am afraid I just don't understand this situation as well as I should.

Thanks for your time and assistance, Rich
Go to the top of the page
 
+
kbrewster
post Jul 17 2006, 12:37 PM
Post #2

UtterAccess VIP
Posts: 4,470
From: NH



How are you entering the data? In a form - subform? If you set up a form subform data entry form, you would just have to make sure you link the master and child fields to the DID.

Also, I am a little worried about your field names in your table. I am not sure if you just put them that way for ease of typing...BUT
Date is a reserved access word, so you should never have a field name called Date...as is Hours, and a few others! I would change your field names before going further as using access reserved words will cause you lots of problems down the road when/if you use VBA or queries...
Go to the top of the page
 
+
oryon122
post Jul 17 2006, 12:47 PM
Post #3

UtterAccess Addict
Posts: 102
From: IL, USA



Hello Kristen,

Oops on the names, I checked Access help for "reserved names" but did not find anything like what you mention, I will search UA as well and make the necessary changes.

The data is entered via the form. This form is used to enter work assignments and is set up as "Continuous Forms" to ease the review of the person entering info as to who and what has already been assigned. Will a subform work in this situation? I was under the impression that I could not use it with continuous forms.

Thanks
Go to the top of the page
 
+
kbrewster
post Jul 17 2006, 12:52 PM
Post #4

UtterAccess VIP
Posts: 4,470
From: NH



Here is a post about reserved words...
http://www.utteraccess.com/forums/showflat...p;Number=539419

Using a subform for this is very easy! Create a form that uses tbl1 as the Record Source. Then with the form in design view, put a subform on the form and follow the wizard. I think on the third prompt it will ask you to choose which fields link the form to the subform, and just make sure that it is DID.
Go to the top of the page
 
+
oryon122
post Jul 17 2006, 12:54 PM
Post #5

UtterAccess Addict
Posts: 102
From: IL, USA



Thank you on both counts. I guess I just should have tried the subform instead of accepting that it wouldn't work. Thanks again and have a great week.

Rich
Go to the top of the page
 
+
oryon122
post Jul 23 2006, 09:41 AM
Post #6

UtterAccess Addict
Posts: 102
From: IL, USA



Hello,

I am checking back in concerning this problem. I have corrected the field names as Kristen suggested. However, using a subform in this instance will not work as the default view of the form is "Continuous Forms" and it will not allow a subform in this circumstance. I can always move the Hours into Tbl1, but that would leave me with a lot of records where this field would be blank and it is my understanding that this is not desireable. Anyone have any ideas? Thanks for your time...

Rich
Go to the top of the page
 
+

Reply to this topicStart new topic

 



RSS Go to Top  ·  Lo-Fi Version Time is now: 9th February 2012 - 11:51 AM