Add data to SubFrom from Main Form

JPR

Registered User.
Local time
Yesterday, 18:05
Joined
Jan 23, 2009
Messages
202
Hello,
I am creating a small db to manage member of a sports club.
I have a two main tables: Members and YearlyFees
Memebers is to store general info.
Yearlyfees is to add the yearly fee each member pays.
The unique code for both tables is ID.

I first add a new memeber, than save the record to the table Memebers. A small line of code will also save the ID to the table Memberfees.
To update a record I double click on the list box.
When I open the form, I would like to show a subform to add the yearly fees that each member pays yearly, but cannot find a solution.


Posting a sample file. Thank you for your help.
 

Attachments

you dont need code to store the ID, the subform does it for you in the subform property:
LINK MASTER FIELDS = ID
LINK CHILD FIELDS = ID
 
Thank you for your reply. Actually this is the way the sub it’s setup.
 
Thank you for your reply. Actually this is the way the sub it’s setup.
No your tables are not setup correctly.
You should have a PK in Members table with a corresponding FK in YearlyFees Table

The PK in Both tables should NOT be ID

Members should be MemberID - Autonumber
YearlyFees should be MemberYearlyFeeID - Autonumber

In the YearlyFees table the FK should be MemberID - Number - Long Integer

Then in the relationship window you need to link both tables on MemberID

Also the record Source of your tables throws up a VB error for missing field Nano ??
 
Several bound controls in the subform are bound to columns that do not - and should not - appear in the recordsource so just remove the controls from the subform and make the fixes Mike suggested also.
 

Users who are viewing this thread

Back
Top Bottom