PK and FK not connecting

JoeyB_99

Registered User.
Local time
Today, 09:14
Joined
Jul 6, 2012
Messages
78
I'm using Access 2007 and my PK for the main table is an auto-number. For table #2 I added a field as an FK of the same type as the PK, long integer, and then linked the PK with the FK.

Both tables were made into forms and separately they work fine. When I make frm_table #2 a subform of the main form nothing appears. Why is that? What else do I have to do to make these keys connect so that the subform of table #2 works properly with the main form?

Please help. I am at wit's end. Any input/comment would be greatly appreciated.
 
Look at the properties of the control that your subform resides in, and see the properties Parent and Child.
 
When you create your Sub-Form you have to ensure that it is linked to the Main_Form , either at the time you insert the sub-form, by following the Sub-Form Wizard, or latter by specifying the Linked Child Fields and Linked Master Fields

attachment.php
 

Attachments

  • Capture.PNG
    Capture.PNG
    15 KB · Views: 273
Thank you for the clarification John. I was looking for a link, but couldn't find a decent one without reading a bunch of stuff, but I didn't want to just leave the OP hanging.
 
No problem. I think We must have been posting at about the same time, but I was delayed as I messed about getting a screen shot.
 
Thank you John BB and speakers_86.

But those fields are filled in properly. I used the Form Wizard and specified that the link was the PK and FK.

Any other suggestions?
 
When I make frm_table #2 a subform of the main form nothing appears.

What does "nothing appears" mean. Please describe.
 
Thanks for your interest Rain Lover. See attached.
 

Attachments

  • db_screen_print.gif
    db_screen_print.gif
    46 KB · Views: 131
It looks like you may have done everything correctly.

To check this out, using the links that you used in the Master Child, check the tables to see if you have Child Fields that match the Master Fields.

This is simply educated guessing from here on but we will eventually track the problem down.
 
Okay, thanks again RainLover for your interest and enthusiasm.

There are no other fields in the other_table that can link to the main table.

I have some news that may be bad. A colleague just pointed something out. My FK should have data in it in order to work. I created the FK field hoping that the Form/Subform process would automatically populate this field based on the value from the PK.

Does that make sense?

Should I post my database?
 
I think that is all correct.

If you enter data in the sub form the PK and FK will populate automatically.

So just try entering data.
 
Once again, thank you for the vote of confidence RainLover.

The attached db is obviously different than my descriptions of my posts. I was trying to generalize to expedite things. I hope you understand.

Please feel free to play with it. I feel I am close but I just can't figure out what I am doing wrong!

Is there someway to have VBA code force the populating of the FK field right away, say when the main form is opened?

Any time and effort expended is greatly appreciated, as well as any comments or suggestions.
 

Attachments

I can't view 2007/10.

If you can convert to 2003 I will have a look. But it is bed time for me, so I will look tomorrow.

That is unless someone else has not helped you out.
 
Get rid of the form in the middle. You have three forms when you only need two.

This was a quick look. Off to bed now.

Will look again tomorrow.
 
UPDATE: When I click on the ellipsis for the Link Master Field and Link Child Fields in the property sheet of the subform I receive an error message "The expression you entered refers to an object that is closed or doesn't exist."
I googled this and am confused by the hits. They talk about VBA code situations. I have no special VBA codes going on in my database. Everyone is welcome to check since I have attached it to this thread.
Again, I'm confused and would like to know what is going on. Any suggestions or tips would be greatly appreciated.
 
I think your tables are set up wrong. Have a look at this. I reworked your tables. Check out the relationships, and notice the notes in the table's comment section.
 

Attachments

I think you should look at your Naming Conventions.

There is a Sky Drive link in my Signature.
 
I think some clarifications are in order here. I do appreciate the efforts though, so please don't get me wrong.

I want my main form to emulate the card that is presently used to collect this data. It is a 2-sided card so I captured both sides onto one document.

The audited by is the employee.

See attached.
 

Attachments

  • blank_BBO_card.jpg
    blank_BBO_card.jpg
    92.7 KB · Views: 86
Going back to the original question and after Speakers has done some mods, are your forms working properly now.
 

Users who are viewing this thread

Back
Top Bottom