Subform does not accept more new records

falcondeer

Registered User.
Local time
Yesterday, 18:01
Joined
May 12, 2013
Messages
101
Hi all,

I have a db for my clinic with 3 tables, one is Patient (P_ID, P_Name, P_Age, P_Sex...etc. The second is Referral (R_ID, R_Date, R_Clinic, R_Diagnosis...etc. The third is Therapist (T_ID, T_Name, T_Division, TherapyDate, T_Plan...etc.

The main form contains all patient info and below I have a subform showing info from both other tables (Referral and Therapist).

Each patient could have more than one referral, so I made the relation between Patient table and Referral table, one to many.

Other relations are as follow:

Patient to Therapist (one to many) because one patient could be treated by different therapist each time he is referred.

Therapist to Referral (one to many) because one therapist could handle many referrals.

Now for the first patient, I entered the first patient info in the main form and then the referral and therapist info in the subform, then the same patient was referred to me for the second time, when I attempted to enter the second record (referral) in the subform I am not able to. Why I do not Know, I am sure I did something wrong.

By the way most of the fields in the subform are comboboxes except for dates.

Can any body help

Thanks.
 
i presume you have a unique key preventing the second visit being added

you would need to make the key dependent on patient PLUS date, say - although that would still gve you a problem if you had two visits in the same day.
 
How are you populating your foreign keys in the Therapist and Referral tables? When you have a relationship established but you do not have a record on the one side or do not fill in the foreign key on the many side you can not add a record to the table. It sounds like you could have that problem. If you want to attach your DB I would take a look.
 
I had a similar problem with a subform which worked perfectly for new entries but stopped when I deleted some Fields in the sub form.

You might try including all the Fields from the Table above in the Sub form but, instead of deleting the Fields you don't want to see, move them to the Form Header and make the Header invisible (for Form view) or, in datasheet view make the columns zero width - It'll accept new entries after that.

I think! good luck.
 
How are you populating your foreign keys in the Therapist and Referral tables? When you have a relationship established but you do not have a record on the one side or do not fill in the foreign key on the many side you can not add a record to the table. It sounds like you could have that problem. If you want to attach your DB I would take a look.


Thanks a lot, I just included all the foreign keys in the connecting table and it is now working.
 

Users who are viewing this thread

Back
Top Bottom