Linking a Popup Form to Subform

  • Thread starter chopper57 via AccessMonster.com
  • Start date
C

chopper57 via AccessMonster.com

I have read a lot of info and tried some from the forums but having no luck,
and I think I even done this on another database a couple of years ago. I'm
using Access 2003.

Problem: Have a main form "MainForm" with a subform "Contracts" and want to
link a popup form "CreditCards". My primary key in the subform is
"ContractNo". On the subform I have an option group called "optPayment"
with 4 options, the 3rd is for Credit Card and I have that set to open the
Popup form "CreditCard" and that works. It's the code to link the PK from
the subform to the popup I can't get correct.
 
B

Ben

Hi Chopper57,

First of all are we viewing data or entering data?

If we're entering data on the popup form, and you would like to "default"
the ContractNo field on the CreditCard form to match that of the SubForm,
you can set the "default value" property of the ContractNo field on the form
to:

Forms!MainForm!Contracts.Form.ContractNo

If we're viewing data then how are you opening the form? If you are using a
docmd.openform action on the afterupdate event of the option group, you can
use (code):

DoCmd.OpenForm "CreditCards", acNormal, , "ContractNo=" & Me.ContractNo

Infering that the data displayed by the "CreditCards" form is filtered to
include only those where the ContractNo matches the ContractNo on the
subform.

If I'm missing the point let me know a little more about what you're trying
to acheive.

Regards,

Ben.
 
C

chopper57 via AccessMonster.com

Ben, I finally got around to fixing the popup with the code you gave me and
it's working great. I have 6 books on Access and couldn't find anything
about using a popup for input. Thanks again.
Hi Chopper57,

First of all are we viewing data or entering data?

If we're entering data on the popup form, and you would like to "default"
the ContractNo field on the CreditCard form to match that of the SubForm,
you can set the "default value" property of the ContractNo field on the form
to:

Forms!MainForm!Contracts.Form.ContractNo

If we're viewing data then how are you opening the form? If you are using a
docmd.openform action on the afterupdate event of the option group, you can
use (code):

DoCmd.OpenForm "CreditCards", acNormal, , "ContractNo=" & Me.ContractNo

Infering that the data displayed by the "CreditCards" form is filtered to
include only those where the ContractNo matches the ContractNo on the
subform.

If I'm missing the point let me know a little more about what you're trying
to acheive.

Regards,

Ben.
I have read a lot of info and tried some from the forums but having no
luck,
[quoted text clipped - 9 lines]
Popup form "CreditCard" and that works. It's the code to link the PK from
the subform to the popup I can't get correct.
 

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