SubForm Result

Mahendra

Registered User.
Local time
Today, 09:42
Joined
Sep 19, 2013
Messages
62
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.​
 

Attachments

I'm trying to understand what the second subform is required to display.

you say
2nd subform needs to display the selected results (On Focus) of 1st subform.
So what is the second subform displaying which cannot be seen in the first subform?

Is it supposed to supply a list of all books by that author or some other factor?

Or if you select a second record on the 1st subform is the 2nd subform supposed to refresh and just display the second record or is it supposed to also retain the first selected record?

At the moment you just have two unbound controlboxes

Please can you explain a bit more - perhaps use some examples
 
I'm trying to understand what the second subform is required to display.

you say

So what is the second subform displaying which cannot be seen in the first subform?

Is it supposed to supply a list of all books by that author or some other factor?

Or if you select a second record on the 1st subform is the 2nd subform supposed to refresh and just display the second record or is it supposed to also retain the first selected record?

At the moment you just have two unbound controlboxes

Please can you explain a bit more - perhaps use some examples

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 do it 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
 
OK, that is fairly straightforward.
  1. On your main form create an an unbound textbox, we'll call it AuthorLink. Leave it visible for now, but once you are happy everything is working, you can set it's visible property to false
  2. In your Squery, add AuthorID to your columns (recommend you lose the space). It does not need to appear in your form - see next step
  3. To hide the authorID from the user, open the results form, rightclick on the AuthorID column and select Hide, then save the form.
  4. in your subform2 set the recordsource to Main and add the controls you want to display - include AuthorID which you can hide it from the user as per the previous step
  5. In your main form, set the subform2 linkchildfield to AuthorID
  6. In your main form, set the subform2 linkmasterfield to AuthorLink
  7. in your subform1 form (results) current event put the following code
Code:
Private Sub Form_Current()
 
    On Error Resume Next [COLOR=seagreen]'if not opening the form as a subform[/COLOR]
    Parent.AuthorLink=AuthorID
    Parent.subform2controlname.Requery [COLOR=seagreen]'change subform2controlname to the name of your [U]subform2 control[/U][/COLOR]
 
End Sub
That should be all you need to do
 
OK, that is fairly straightforward.
  1. On your main form create an an unbound textbox, we'll call it AuthorLink. Leave it visible for now, but once you are happy everything is working, you can set it's visible property to false
  2. In your Squery, add AuthorID to your columns (recommend you lose the space). It does not need to appear in your form - see next step
  3. To hide the authorID from the user, open the results form, rightclick on the AuthorID column and select Hide, then save the form.
  4. in your subform2 set the recordsource to Main and add the controls you want to display - include AuthorID which you can hide it from the user as per the previous step
  5. In your main form, set the subform2 linkchildfield to AuthorID
  6. In your main form, set the subform2 linkmasterfield to AuthorLink
  7. in your subform1 form (results) current event put the following code
Code:
Private Sub Form_Current()
 
    On Error Resume Next [COLOR=seagreen]'if not opening the form as a subform[/COLOR]
    Parent.AuthorLink=AuthorID
    Parent.subform2controlname.Requery [COLOR=seagreen]'change subform2controlname to the name of your [U]subform2 control[/U][/COLOR]
 
End Sub
That should be all you need to do

Hello CJ_London,

Am not getting AuthorLink while I was trying to set the subform2 linkmasterfield to AuthorLink.

AuthorLink is not getting in the options overthere.

Could you kindly have a look into this.
 

Users who are viewing this thread

Back
Top Bottom