Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2016
    Posts
    16

    Answered: Open Form With Only Data Based on Value Clicked on Another Form

    I have a table that contains all of the departments of the company with a few other fields of information for each department. Then I have a form that lists all of the departments from a query. The team would like to be able to click on department (textbox) that's shown in the form and open another form with only information for the department that was clicked. They do not want a combo box. I don't want to create a separate query and form for each department. What is the best way to accomplish this? We are using Microsoft Access 2010.

  2. Best Answer
    Posted by ranman256

    "filter the form as it opens. This example assumes the dept is a string....

    docmd.openForm "myDetailForm",,,"[dept]='" & me.dept & "'""


  3. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    629
    Provided Answers: 33
    filter the form as it opens. This example assumes the dept is a string....

    docmd.openForm "myDetailForm",,,"[dept]='" & me.dept & "'"

  4. #3
    Join Date
    Dec 2016
    Posts
    16
    So simple. I love it. Thanks. I'm learning every day thanks to the people on forums like this.

  5. #4
    Join Date
    Dec 2016
    Posts
    16
    ranman256,

    I need to take this another step further. While in the filtered form, I need to run a query to filter the results of the data in the subform while maintaining the filter. The query is already set-up and I have a command button but am not sure how to implement it.

    Form name is frmOfficeDetails
    Subform name is sfrmResouces
    Field that joins the two is "Office"

    Any suggestions are greatly appreciation.

  6. #5
    Join Date
    Dec 2016
    Posts
    16
    You can disregard my last post. I have figured it out. Thanks.

  7. #6
    Join Date
    Dec 2016
    Posts
    16
    Hoping you can help with a similar situation. I have a main form with a subform. I have added a command button in the footer. I would like to be able to click the command button to open another form "Edit Record" that contains the same data in the subform but I would like to filter to the current record that I was on in the subform. The code you provided is not working for this situation.

Posting Permissions

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