Results 1 to 6 of 6
  1. #1
    Fipper_SG is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    23

    Open a form based on a subform value

    First, let me explain what I`m trying to do. This will help me to clearly define my problem.




    This database can be basically divided into two sections: Logs and Subjects.


    For the first section, I have four logs. However, in the sample database, only the Event Log is present. Each of these logs have two form: a List one (Event_Log) and a Detailed one (Event_Details). As you can see, in the Detailed one, there is a subform showing the subjects it is related to.


    The second section of the database contains the subjects that are used to indicate what the logs are related to. This section is broken down in four parts: personnalities, organizations, places and other. These subjects all have detailed pages that show all logs records they are related to (Related_to_Organization_Details; Related_To_Others_Details; Related_To_Personnalities_Details; and Related_To_Places_Details). When you open one of these four, The four tabs contain subform showing the records of the respective logs where these subjects are related to.


    Please tell me if what I`m saying doesn`t make sense...


    So, what I would like to do is, when I`m looking to a detailed page of a subject, to be able to double-click on the shown records and then be able to go to the detailed page of this log. (In the Sample, open the Related_To_Personnalities_Details form and go to the Event Log tab. In this example, I would like to be able to have the detailed page about Personnality A being spotted by just double-clicking on it)


    Also, I would like to be able to do the opposite, but if the first one can be possible, I`m pretty sure I can find my way to get this one to work also (there is four Related table... so also need to tell them what is the good one to open)

    I did search on the site and internet on how to do it, but I cant make it work... I am obviously doing something wrong... Any help will be greatly appreciated.

    HERE IS THE SAMPLE DATABASE: LogBook.zip

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Copy your subform by using the "save as"
    Open your subform in edit view
    Create a control button using the wizard
    Ask the wizard to open another form using specific criteria
    Open your copied subform in form view and test your new Button
    Copy the VBA your Wizard created and paste it into the DoubleClick event of the control you choose on your original subform

  3. #3
    Fipper_SG is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    23
    Quote Originally Posted by ItsMe View Post
    Copy your subform by using the "save as"
    Open your subform in edit view
    Create a control button using the wizard
    Ask the wizard to open another form using specific criteria
    Open your copied subform in form view and test your new Button
    Copy the VBA your Wizard created and paste it into the DoubleClick event of the control you choose on your original subform

    I think that is not exactly it...

    I want to open the other form at the same record as the one that is double clicked in the subform. Basically, an openform with Me.ID..

    Problem is I can't make it to go and get this Me.ID...

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I am not sure what the problem could be. The wizard should have asked what form you want to open. It would then place the form name you chose in a string called "stDocName". When you reply "Yes" to if you want to find a specific record it will build another string. The "stLinkCriteria". string is the criteria that will go after the specific recod ot records.

    The "DoCmd.OpenForm" line of code created by the wizard will open the form described in the "stDocName" in a new window matching the criteria in "stLinkCriteria". Copying this code into your ORIGINAL subform in the double click event of your chosen control, textbox or whatever should do the trick.

    Did you make a COPY of the subform? Did you use the wizard to create a control button?

  5. #5
    Fipper_SG is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    23
    Quote Originally Posted by ItsMe View Post
    I am not sure what the problem could be. The wizard should have asked what form you want to open. It would then place the form name you chose in a string called "stDocName". When you reply "Yes" to if you want to find a specific record it will build another string. The "stLinkCriteria". string is the criteria that will go after the specific recod ot records.

    The "DoCmd.OpenForm" line of code created by the wizard will open the form described in the "stDocName" in a new window matching the criteria in "stLinkCriteria". Copying this code into your ORIGINAL subform in the double click event of your chosen control, textbox or whatever should do the trick.

    Did you make a COPY of the subform? Did you use the wizard to create a control button?
    Oh my god! It works! Thank you so much!

    It worked at the beginning, I simply misunderstood a part.

    Thanks again!

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Go ahead and mark this thread as solved if you are satisfied.

    Glad you were able to step through the process. There are a couple good examples in the code the wizard created. You might want to reference it again sometime.

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

Similar Threads

  1. Replies: 2
    Last Post: 04-01-2013, 04:23 PM
  2. Open form based on subform - possible
    By Richie27 in forum Access
    Replies: 2
    Last Post: 06-19-2012, 12:52 PM
  3. open form based on combobox
    By bigmac in forum Forms
    Replies: 3
    Last Post: 04-09-2012, 11:25 AM
  4. Replies: 2
    Last Post: 08-11-2011, 10:02 AM
  5. Open form based on Subform criteria
    By Suzan in forum Programming
    Replies: 0
    Last Post: 04-25-2006, 02:28 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