Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Location
    United Kingdom
    Posts
    56

    Unhappy Unanswered: Opening one form from another on the same record

    Help me!!??

    I have a form "frmCommercialTrials" with a field called "cboProjectRef", (the control source of which is [ProjectReference].

    I have a button on this form and when I click on it I want it to open a form called "frmFundingDistribution" on the current record of the original form, (this form also has a field called "cboProjectRef", - the control source of which is [ProjectReference]).

    I can get the form the open easy enough but cannot get it to do the above. I can pull this off when opening a report by using the code below. Do I need to use something similar?

    Rusty



    Private Sub cmdCheckCost_Click()

    DoCmd.OpenReport "rptEventPaymentsCrossCheck", acPreview, , "[ProjectReference] like '" & Me![cboProjectRef] & "'"

    End Sub

  2. #2
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    Hi Rusty,

    Try this, using the CommandButton with your Wizards turn ON....Click and place on your form the CommandButton...then when prompted click FormOperations, then Open Form. Next, Select the form you wish to open and click NEXT, then choose the first option "Open the form and find specific data to display", NEXT, Select your Fields from each table that Match...like Primary, ForeignKeys that tie them together and click NEXT, then click your way on through the rest. See if that gets you just what you are looking for. Just need to make sure your Relationships are set up correctly. Let me know if that helps any.

    have a nice one,
    Bud

  3. #3
    Join Date
    Apr 2004
    Location
    United Kingdom
    Posts
    56

    Talking

    Thanks for the help Bud. I managed to crack it using the following code for the command button:

    DoCmd.OpenForm "frmFundingDistribution", acNormal, , "[ProjectReference] like '" & Me![cboProjectRef] & "'", , acWindowNormal, ""


    NB: [ProjectReference] is the Control Source name of the field, and [cboProjectRef] is the field name as it appears on the form. This all has to appear in the 'Where Condition' part of the code.

    Cheers,

    Rusty

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •