Question : relate field in main form to similar field in subform

i have a main form called opportunityinput which is for entering sales opportunities.  This main form populates a table called salesopportunities.  On this form is a field called opportunityID.  Each sales opportunity gets its own opportunityID number.  I have a subform called phonelog for logging telephone calls related to that particular opportunityID.  This subform populates a table called phonelog.  On this subform i also have a field called opportunityID, which shows which sales opportunity the phonelog calls are tied to.  I have established a one to many relationship between the opportunityID field in the main form table, and the opportunityID field in the subform table.  When i have done this before, it worked exactly the way i wanted.  The opportunityID field on the subform automatically populated with the proper ID number based on which opportunity you were in on the main form.  The field wasn't changeable on the subform.  The problem is that i have a need to do this again, and i dont recall how i did this.  As it stands now, the subform opportunityID field does not show anything, even though i am in a particular opportunityID on the main form.  Can anybody remind me how to do this?  thanks for the help!

Answer : relate field in main form to similar field in subform

Open your main form in design view.  The first click of the subform will select the subform control, the container that holds an instance of the other form. Open the properties window and you'll see on the Data tab Link Child Fields and Link Master Fields. You'll want to set both of these to: opportunityID , since it's spelled the same way on both tables. I think Access would have set these for you automatically if you had a relationship defined between the parent and child tables when you added the subform. Anyhow, you can add it manually. This will give you the desired unchangeable, auto-filtering behavior.

HTH,

pT72
Random Solutions  
 
programming4us programming4us