Results 1 to 6 of 6
  1. #1
    nika.duncan is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Nov 2013
    Posts
    36

    Passing Values from One Form to Another Form - Enter Parameter Value Issue

    Hi Everyone,
    I have a form called Customer and a subform called CustomerDetail. Once I click on the button "Open Form" on the CustomerDetail form I want to be able to see only the transactions for that customer. I used the embedded macro below to pass the data.

    "[CustomerDetail]![CustomerDetailID]=[TransactionDetail]![Cust_DetailID]"

    When I clicked on the button I receive the message "Enter Parameter Value" once I enter the "CustomerDetailID" the transaction details will be listed. I need the form to be open without the message and the transaction details listed.

    Any assistance in removing this message will be appreciated. I have included the database "Cambio3.zip as well.

    Thanks,
    Nika
    Attached Files Attached Files

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    I'm not sure where exactly this macro is situated in your database. Try adding [Forms]! in front of both form names above.

  3. #3
    nika.duncan is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Nov 2013
    Posts
    36
    The macro is on the Open Form Button that is situated on the CustomerDetail form on the On Click property. I have added the [Forms]! before both forms and I still receive the error shown below. This time it does not pass the value.



    Thanks
    Nika

  4. #4
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    When you use a form as a subform, it does not become a part of the Forms! collection, so in the macro expression:

    "[CustomerDetail]![CustomerDetailID]=[TransactionDetail]![Cust_DetailID]",

    [CustomerDetail]! does not refer to an open form (it's a subform) so you get prompted to enter for a value.

    I hate macros with a passion (!) so in the CustomerDetail Subform I replaced the macro with an Event procedure:

    Code:
    Private Sub cmdTransction_Click()
      DoCmd.OpenForm "transactionDetail", , , "Cust_DetailID = " & Me!CustomerDetailID
    End Sub
    and it worked fine.

    Notice the use of Me! in the DoCmd - Me! will always refer to the form where it is used, even when it is a subform.

  5. #5
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Put this in the Filter (not the Where) : Cust_DetailID=forms!customer![customerdetail subform!CustomerDetailID

  6. #6
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Not quite the right syntax for the filter:

    Cust_DetailID=forms!customer![customerdetail subform].form!CustomerDetailID

    A subform is not usually referred to by the form name in a context such as this.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Get Rid of Enter Parameter Values
    By rpraveen6r in forum Queries
    Replies: 2
    Last Post: 07-12-2016, 08:00 AM
  2. Passing a Form Textbox to a query parameter
    By NickWren in forum Access
    Replies: 2
    Last Post: 06-28-2016, 08:43 AM
  3. Passing parameter form value to a query result
    By OtakiriLad in forum Queries
    Replies: 3
    Last Post: 11-27-2015, 09:25 PM
  4. Passing parameter from form to query
    By rhubarb in forum Forms
    Replies: 3
    Last Post: 05-03-2015, 10:29 AM
  5. Replies: 10
    Last Post: 09-27-2010, 08:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums