Command button to open a form

C

Clifford F. Lewis

I have created a Contacts database based on the Contact Management
template. The form for entering contacts has a command button for
phone calls. When I click on the button, it opens a form for phone
call records. The form shows the name of the contact, and the record
is associated with the contact, so that only calls to that contact are
visible.

I have tried to add a similar form and command button for meetings.
The meetings table has a ContactID field with a many-to-one
relationship to the Contact table. In the command button wizard, I
specified a match between ContactID fields of the two tables. But I
cannot get the form to automatically fill in the ContactID when it is
opened. As a result, the new record is not associated with that
contact. If I fill in the ContactID manually, the record becomes
associated with the contact, but I want it to be automatic.

How do I get it to do that?

Thanks,
Cliff Lewis
 
T

tina

in the template, the Calls button on the Contacts form does nothing except
open the Calls form. the link between the Contacts record and Calls records
is established by the setup the of the Calls mainform/subform.
is there a reason why you're deviating from the solution used in the Calls
form setup?
 
C

Clifford F. Lewis

I do not understand how it is done in the Calls form. If I did, I
would do the same.
 
T

tina

when you're looking at somebody else's database to see how something works,
you have to "deconstruct" the process. start with the end result - in this
case, the command button - and "drill down" from there.
when you look at the code behind the command button on the Contacts form,
you see that it only opens the Calls form, without utilizing any filter,
Where clause, or open arguments. so you figure that the records have to be
filtered from within the Calls form.
so you open that form in design view and check the Open event, Load event
and the RecordSource property, for starters. in this case you see that the
records are filtered in the RecordSource's SELECT statement - which is
pulling the ContactID from the Contacts table, and is not connected to the
Calls table at all. the Calls table is actually bound to a subform in the
Calls form. so the Calls records are presented in a subform, with the
LinkChildFields and LinkMasterFields both set to ContactID.
if all of this is over you head, you probably need to get a beginning Access
textbook and get comfortable with the basics before moving forward. suggest
Microsoft Access <version> Bible, and there are other good books out there
as well.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top