Creating new records in a popup subform

G

Guest

Setup:

Main form (Contacts Form), based on a query of a "Contacts" table, that
returns all contacts. The main form has a search bar at the top. When
contacts are selected, their ContactID shows up as well as the rest of their
information.

A second form (Contact History), based on a query of the "Contact History"
table, which is linked to the "Contacts" table via ContactID. The Contact
History form's underlying query sets the criteria for ContactID to look up
the ContactID control in the Contacts Form. So, I select Contact A on the
Contacts Form, Contact A's ContactID comes up along with the other contact
information, and I can then open the Contact History form and view whatever
records in the "Contact History" table match Contact A's ContactID.

I also want users to be able to create NEW records in the Contact History
table via this Contact History Form, for whatever contact they're reviewing.
If they're looking at two Contact History records for Contact A, I want them
to be able to add a third, with the same ContactID.

When the Contacts Form and the Contact History form are completely separate,
this doesn't work. You can use the navigation buttons to click to a new
record, or use a command button with the Add Record script provided by
Access, but the ContactID which was retrieved from the Contacts Form is not
preserved -- it just empties that control in the form.

When the Contact History form is placed as a subform in the main Contacts
Form, with the ContactID fields linked, the Contact ID does stick around (I
guess because of the linked fields).

I'm happy for the Contacts History form to be a subform, but I really want
it to be a popup -- instead of cluttering up the main Contacts Form
interface. Can someone tell me how to do that?

Or, alternately, I can easily keep the Contact History form separate and
open it as a popup using a command button on the Contacts Form, but I need a
way to preserve the "retrieved" ContactID when creating new records.

Any help would be super-appreciated.
 
H

heifler via AccessMonster.com

You need a field in the popup Contact History Form source that going to
store the ContactID
You then set the default value of the field in the popup form to Forms!["Name
of Main Form"].[ContactID] this will ensure that the subform's new records
always have the foreign key to the Contacts form. Let me know how this goes.
See my signature.
Setup:

Main form (Contacts Form), based on a query of a "Contacts" table, that
returns all contacts. The main form has a search bar at the top. When
contacts are selected, their ContactID shows up as well as the rest of their
information.

A second form (Contact History), based on a query of the "Contact History"
table, which is linked to the "Contacts" table via ContactID. The Contact
History form's underlying query sets the criteria for ContactID to look up
the ContactID control in the Contacts Form. So, I select Contact A on the
Contacts Form, Contact A's ContactID comes up along with the other contact
information, and I can then open the Contact History form and view whatever
records in the "Contact History" table match Contact A's ContactID.

I also want users to be able to create NEW records in the Contact History
table via this Contact History Form, for whatever contact they're reviewing.
If they're looking at two Contact History records for Contact A, I want them
to be able to add a third, with the same ContactID.

When the Contacts Form and the Contact History form are completely separate,
this doesn't work. You can use the navigation buttons to click to a new
record, or use a command button with the Add Record script provided by
Access, but the ContactID which was retrieved from the Contacts Form is not
preserved -- it just empties that control in the form.

When the Contact History form is placed as a subform in the main Contacts
Form, with the ContactID fields linked, the Contact ID does stick around (I
guess because of the linked fields).

I'm happy for the Contacts History form to be a subform, but I really want
it to be a popup -- instead of cluttering up the main Contacts Form
interface. Can someone tell me how to do that?

Or, alternately, I can easily keep the Contact History form separate and
open it as a popup using a command button on the Contacts Form, but I need a
way to preserve the "retrieved" ContactID when creating new records.

Any help would be super-appreciated.

--
Bob Heifler
My Access Program, Owner
www.myaccessprogram.com
info (At) MyAccessProgram (Dot) com

Message posted via AccessMonster.com
 

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

Similar Threads


Top