Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best way to open up new form from field in subform

Status
Not open for further replies.

guayabita

MIS
Jun 10, 2004
13
US
II have a form [frmIndividual] with a subform [sbfOrgsContact]. The form shows a list of organizations for wich the individual is the main contact. I would like to double click the field [Org_NAME] and have the form [frmOrg] open up to the record for that organization.

Currently I have a macro set up on double click where the condition is:
[Org_ID]=Forms![sbfOrgsContact]![Org_ID]

but it only works when you open up the subform independently.

I have also tried (but this doesn't work from anywhere):
[Org_ID]=[Forms]![frmIndividual]![sbfOrgsContact].[Form]![Org_ID]

Should I not be using macros?

Thanks!!!
      
 
Is sbfOrgsContact the name of the control in frmIndividual ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
[sbfOrgsContact] is the subform. The control in the subform is [org_NAME]. I'm trying to double click on [org_NAME] and have the second form open up wiht all the details for the organization [frmOrg].
 
What is the name, in frmIndividual, of the control hosting the sbfOrgsContact subform ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hmm. I feel a little stupid, but I think this is what you are asking.

I selected the sbfOrgsContact in the parent form and in Properties>>Name it is OrgsContact.

Does that sound right?
 
OK, so you may try this:
[Org_ID]=[Forms]![frmIndividual]![OrgsContact].[Form]![Org_ID]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Well,

It's a total hack but it works.

Here is what I did:

1. i just added an Org_ID field to sbfOrgsContact and made it invisible
2. added a button to open the new form using the wizard and Org_ID to match on
3. I copied the code for this button to the event I had for double clicking on the Org_Name field (repplaced the names where appropriate)

Here is the wizard created code:
Code:
Private Sub Org_Name_DblClick(Cancel As Integer)
On Error GoTo Err_Org_Name_DblClick

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmOrg"
    
    stLinkCriteria = "[Org_ID]=" & Me![Org_ID]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Org_Name_DblClick:
    Exit Sub

Err_Org_Name_DblClick:
    MsgBox Err.Description
    Resume Exit_Org_Name_DblClick
       
End Sub

Thanks for your suggestions PHV!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top