HELP! Need command button to open form from tab control subform.

L

LavndrAndy

Hitting a snag in my design and could use some help. I tried implementing a
suggestion by another in the MS discussion groups, but my command button
still didn't work. Here's the scenario:

I'm using a continuous form with a command button to allow the user to open
a form to show more detail about a specific record. No problem there (form
opens via the command button with no issues) -- until I insert that
continuous form as a subform on a tab control in another form. When I try to
access the command button from the subform within the tab control, I get an
error message about incorrect syntax. Below is one of the versions I've
tried to incorporate within the Event Procedure for the command button:

Parent form: frmProjectDetail (the form with the tab control and subform)
Subform: frmsubContacts (a continuous form)
Key field: ContactID
Form being opened: frmContacts

stLinkCriteria = "Forms![frmContacts].[ContactID]=" &
Forms![frmsubContacts].[ContactID]

I'd appreciate any suggestions. Thanks!
 
T

Tim Ferguson

Parent form: frmProjectDetail (the form with the tab control and
subform)
Subform: frmsubContacts (a continuous form)
Key field: ContactID
Form being opened: frmContacts

stLinkCriteria = "Forms![frmContacts].[ContactID]=" &
Forms![frmsubContacts].[ContactID]

If you want to get at a form contained inside a subform control, you need
to go via the .Form property of the subform control:

stLinkCriterion = "Forms!frmContacts!ContactID = " & _
Forms!frmProjectDetail!frmsubContacts.Form!ContactID


Hope that helps


Tim F
 

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