Link Popup form to master

J

Jacqueline

I would like to create popup forms activated from a button within my master
form to keep things less congested.

Is there a way to link the popup to the primary key of the current record of
the master when the popup is activated?

Thanks much for any help.
I am using Access 2007
 
J

Jeff Boyce

Jacqueline

Take a look at Access HELP on the syntax of the OpenForm command ... there's
a paramter that lets you specify a WHERE clause. You could use that to have
the popup form only load the record selected by the main form.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
N

NetworkTrade

and another way to do the same thing is to source the popup form on a query;
while having that query use a parameter of the current record of the master
form
 
T

Tank

Hi Jacqueline,

Like you, there are times when I need to use a pop-up form to record
additional information on my first page where space on the first page is not
sufficient. For example, I may want to record additional phone numbers or
multiple email addresses for a person, and I just do not have enough room to
place controls for those extra fields on the page. I also do not want to
create a second page for the information, as other pages are devoted to other
subjects, and I do not want to create another table for a many-to-one listing.

For purposes of example, my pop-up may hold separate controls for each of
the following:
Tel1, Tel2, Tel3 (or home phone, work phone, day phone, evening phone, etc.
Fax
Cell
Email1, Email2, Email3

The first page of my master form records a person’s name and address and may
also include a primary phone (Tel1) and possibly a secondary, if room permits
(Tel2), along with a primary email address (Email1). My pop-up will also
list this information along with Tel3, Email2 and Email3, etc. In some
situations, such as fund raising databases, a pop-up might list a seasonal
residence address and phone number(s) for donor “snowbirds†traveling south
for the winter. Data entry and edit, of course, could be performed on the
pop-up form.

If my master form used a “Persons†table as control source with a “PersonIDâ€
(number datatype) as the primary key, and the pop-up form, named,
ExtraContacts_PopUp, used the same table as control source, you could use the
following expression to link the pop-up form to display the same record as
the current record of the master form.

This works for me. Place a command button on the master form. Then create
an event procedure (“On Click†in the master form’s Design View Property
Sheet) that would run (and open the pop-up form) when clicked as follows:

Private Sub OpenForm_ExtraContacts_PopUp_Click()

Me.Refresh
DoCmd.OpenForm "ExtraContacts_PopUp", , , "[PersonID] = " & [PersonID], ,
acDialog

End Sub

The DoCmd, of course, is all on one line.

Note #1: that the Me.Refresh before the DoCmd line allows the entry on the
pop-up form to immediately display when you return to the master form and
vice versa if you enter a phone number on the main form, it will immediately
display on the pop-up form when opened.

Note #2: If the primary Key field is Text datatype, then use:

DoCmd.OpenForm "ExtraContacts_PopUp", , , "[PersonID] = '" & [PersonID] &
"'", ,acDialog

There are many other ways to handle this, but I have found the above version
to be the shortest and most effective.
Hope this helps,
- - -
Tank
 

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