Form / Subform problem

sparky5

Registered User.
Local time
Yesterday, 21:19
Joined
Apr 23, 2005
Messages
15
I have a table of contacts and a table of calls logged. They are related based on the (main) Contacts table PropertyID field with the same field in the Calls table. I have a main form for the Contacts table and a subform for the Calls table. I open the subform with a command button on the main form and the Calls subform opens perfectly except that it shows ALL call records and not just the ones related to the current record of the Contacts form. How can I get the subform to only pull the corresponding calls and not every call.
I hope I have explained it somewhat clearly. I appreciate any help!
 
I solved that problem with a WhereCondition in the OpenForm code, BUT now I have discovered ANOTHER problem. Aaargh. When I move to a record on the main form that hasn't had a call logged (or say, a new record), the subform does not show the PropertyID value from the main form. I can enter a call memo, date, etc on the subform, but when I checked the Calls table, it didn't store the PropertyID number. I need a way for the main form to push the PropertyID value into the subform (and into the table) as I don't want to have to manually enter this each time. Any thoughts? Greatly appreciated.
 
Form

Put the subform on the main form and set the Master/Child fields.
That will 'synchronize' the records in both tables, provided there is a correct one-to-may relationship.

In case you do want a separate form use the solution that is given in this thread:

http://www.access-programmers.co.uk/forums/showthread.php?t=85870
 
Subform has always been on the main form with Master/Child fields linked. What I am currently trying is the following code somewhere:

If IsNull(Me.PropertyID) Then
Me.PropertyID.Value = [Forms]![Contacts]![PropertyID]
End If

I have tried it in both the subforms open and current events with no luck. I will try a few other events as well, but not even sure if this is the code or strategy I need. Thanks for help.
 
Form

Do you want to display the PropertyID in the Header of the subform?

You can put an inbound box there and set the control source to:
=Forms!frmContacts!PropertyID
 
Thanks for the reply. I think I might have it licked. :rolleyes:

I moved the code I had for the PropertyID GotFocus to the Date GotFocus (Date is actually the first field I want the users to see and use) and it works like a charm. I don't really need / want to display the key field to the user, so it worked out in the end.

I appreciate your help and this forum in general and hope that I might be able to help someone else out in the future. :)
 

Users who are viewing this thread

Back
Top Bottom