Results 1 to 8 of 8
  1. #1
    Mahendra1000 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2013
    Posts
    101

    SubForm Result

    Hello,

    I have a main form which displays the results in the subform.

    My requirement :

    I have 1 main form and 2 subforms in that form.

    I just wanted to have a get focus function on my 1st subform and needs to display the focusing result in the next 2nd subform.

    In Detail :



    I had a main form of search boxes Author, Published, title

    If you search for 1999 in published text box then it will display all the results whose published year is 1999 along with those respective Author and Title in the 1st subform

    In the result 1st subform if an ID is selected by the cursor then that entire row needs to be displayed in the next 2nd subform (As of now I wanted only 2 column details of the focussed result).

    1st subform needs to display all the searched results (It was done and it works fine)

    2nd subform needs to display the selected results (On Focus) of 1st subform.

    Could you kindly let me know how to deal with the 2nd subform linking uo with the 1st subform.

    Attached is the file. Kindly have a look into this and let me know on how to proceed further.

    Can anyone help me out in getting done with the 2nd subform.

    MForm is the main form and Main is the main table
    Attached Files Attached Files

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Can you post a copy in A2003 mdb format.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Mahendra1000 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2013
    Posts
    101
    Quote Originally Posted by Bob Fitz View Post
    Can you post a copy in A2003 mdb format.
    Kindly have a look into the A2003 mdb format.

    My 1st subform "Results" displays all the searched results and the output of 1st subform looks like below

    Results :

    ID Author Title Publication Keywords ContributedAuthors
    1 xx xx xx xx xx
    2 xx xx xx xx xx
    3 xx xx xx xx xx
    4 xx xx xx xx xx

    If you click on ID 1 in the 1st subform then the 2nd subform should display the details of only ID 1 (ID, Author, Title)

    so my 2nd subform should looks like

    ID Author Title
    1 xx xx

    If you move the cursor to 3rd record then the 2nd subform should have to display the results of only ID 3 and the previous data has to be erased from the 2nd subform.

    ID Author Title
    3 xx xx

    I don't know how to deal with the 2nd subform and I was stuck at this point for past 6 days. Could you kindly let me know how to do this please.

    Let me know if you are unclear with my explanation.

    I will expalin you again in detail if you need.

    Please help me out
    Attached Files Attached Files

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Take a look at the attached db. Hopefully, this is what you require. Post back if you have any questions.
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    Mahendra1000 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2013
    Posts
    101
    Thank you sooooooo much......
    This is exactly what I need.

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    To synchronize a sub form, you need to set its “Link Child Fields” and its “Link Master Fields” properties to the fields that link the data. The “Link Child Fields” would be set to the field in the sub form, while the “Link Master Fields” would be set to a field in the master form. As you want to link to a field in another sub form, we must first create a field in the master form which has its “Control Source” property set to the field in the first sub form.
    In the solution I proposed earlier, this field is called “TextByBob” and its Control Source is set to “=[Results].[Form]![ID]” which is the field in the first sub form to which the second sub form is now linked.
    I hope this makes sense. For the benefit of other users, if you have any further questions please asked them within this thread. You may also get an answer sooner.

    Perhaps I can ask what the purpose of the second sub form is. It has the same data source as the first subform and shows some of the same data.

    You may want to change the last line of code in the On Click event of the button called Command23 from:
    Me.Requery
    To:
    Me.Results.Requery

    Also, IMHO, it would be better to give controls like this button a more informative name. Perhaps something like cmdClear.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  7. #7
    Mahendra1000 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2013
    Posts
    101
    Quote Originally Posted by Bob Fitz View Post
    To synchronize a sub form, you need to set its “Link Child Fields” and its “Link Master Fields” properties to the fields that link the data. The “Link Child Fields” would be set to the field in the sub form, while the “Link Master Fields” would be set to a field in the master form. As you want to link to a field in another sub form, we must first create a field in the master form which has its “Control Source” property set to the field in the first sub form.
    In the solution I proposed earlier, this field is called “TextByBob” and its Control Source is set to “=[Results].[Form]![ID]” which is the field in the first sub form to which the second sub form is now linked.
    I hope this makes sense. For the benefit of other users, if you have any further questions please asked them within this thread. You may also get an answer sooner.

    Perhaps I can ask what the purpose of the second sub form is. It has the same data source as the first subform and shows some of the same data.

    --We are going to display another field in the second subform which doesn't exist in Main form and Subform. The field name is ABSTRACT

    You may want to change the last line of code in the On Click event of the button called Command23 from:
    Me.Requery
    To:
    Me.Results.Requery

    Also, IMHO, it would be better to give controls like this button a more informative name. Perhaps something like cmdClear.
    Hello Bob,

    I have marked some of my answers in your above post in RED. Hope it clears your doubt.

    The second subform is clear in displaying the data.

    There is one error in second subform at somepoint.

    If we entering anything in the search boxes (Consider you enter ABC in Author field and 4 in Pages field) before pressing the SEARCH button the subform is going to disappear (I mean it's not displaying the reults which it contains before entering something in the search boxes)

    I request you to kindly have a look into this.

    I mean

    Enter something in Author Name and enter something in University or email or pages and don't press SEARCH button (Wait for 2sec). You can see that the subform disappears. Even if you select any record in the 1st subform it's not displaying the result in the 2nd subform.

    Summary : The subform is going to disppear if we enter anything in the search boxes.

    Attached is the project in 2003 Version. Please help me out.....
    Attached Files Attached Files

  8. #8
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    I think the problems you had were caused because the text boxes used on the main form are also used for criteria in the query for the sub forms. As you exit one of these textboxes the recordset of the sub forms changes but the sub forms are not re-queried.
    Take a look at the attached db. I don’t think the “Search“ button is required now because I have added some code to re-query both sub forms after each criteria is entered.
    Because I had plenty of spare time today, I have altered the tab order of the forms controls and added a button to close the form. I have also made what I consider to be a couple of visual enhancements. I hope you agree.
    I think this fulfils your requirements, but if not please post back.
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. displaying query result as a subform
    By uzair_rosli in forum Access
    Replies: 4
    Last Post: 02-26-2013, 04:29 AM
  2. Replies: 3
    Last Post: 10-31-2012, 12:14 PM
  3. View Macro Result in subform
    By rato999 in forum Programming
    Replies: 1
    Last Post: 01-23-2011, 09:34 PM
  4. can i put the result in array?
    By dada in forum Programming
    Replies: 1
    Last Post: 08-19-2010, 07:17 PM
  5. how to return the result?
    By lamkee in forum Access
    Replies: 1
    Last Post: 08-10-2010, 10:50 AM

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