Displaying Results on the Same Page

Mahendra

Registered User.
Local time
Today, 11:12
Joined
Sep 19, 2013
Messages
62
Hello,

I have created a table with name "Main". It consists of fields ID, Author, Title, Abstract, Page and Published.

I have created a form named "MFORM" with text boxes Author, Title, Abstract, Page and Published,and then I created a search and clear parameters buttons below the text box.

Then I dragged my Search Query into the bottom of my form MFORM and named it as "All Results".

When I click on search then the results are displayed in the new tab instead of bottom of my main form in Search query.


What I needed?

If I enter author name as Mike and then click on search button then results should display all the details related to Mike on the bottom of my form.

All Results [At the Bottom of my page]

Should display all the details related to Mike.

I had attached my database. I just need the search results at the bottom of my main form in stead of displaying in new tab. Could you kinldy have a look into it and let me know on this please.
 

Attachments

Hello Mahendra, Welcome to AWF. :)

You need to Requery the SubForm. First give the subForm a proper name, say resultSubFrm. Then Code the button to Requery it.
Code:
Private Sub Command22_Click()
    Me.resultSubFrm.Form.Requery
End Sub
 
Hello Mahendra, Welcome to AWF. :)

You need to Requery the SubForm. First give the subForm a proper name, say resultSubFrm. Then Code the button to Requery it.
Code:
Private Sub Command22_Click()
    Me.resultSubFrm.Form.Requery
End Sub

Hello,

Thanks for the quick turn around on my query.

Am new to MS access and am still in learning the basics of it.

I kindly request you to elaborate your last post.

How to create a subform in my form with name resultSubFrm. I think that I don't have any subform in the attached file which I had posted above.
 
Well when you dragged and dropped the Query into the Form, it will be a Sunform object. Normally people tend to 'Create a SubForm' based on related tables and then use that Form object to Link Parent and Child fields.

However your design is not really based on that. So what you need to do is go to the MFORM design view click on the Query.sQuery boxand in the Other tab, you will have the first Row entry saying name, change it from Query.sQuery to resultSubFrm. Then on the Button click paste the CODE I gave you.

Make sure the On Click event says [Event Procedure] instead of [Embedded Macro].
 
Hello pr2-eugin,

Thanks a Ton!!

The way you explained to me was clear and awesome.

I got it :)
 
Okay, sounds to me like you have sorted the issue. Please post back if you have troubles. Good Luck ! :)
 
Hello pr2-eugin,

The results displayed by the search button are having write access too. I don't want the users to have write permissions.

I just want the read access from the results returned from the search button.

Previously I had run them through a macro by permitting the access to Read only. But now I ran the search button through Event Procedure VBA code provided by you.

Could you kindly help me it out for setting the results to Read only in VBA please?
 
The simple and easy answer would be to do a TOTAL query, just add group by to the sQuery. Replace the SQuery to the following.
Code:
SELECT Main.Authors, Main.Title, Main.Language, Main.Pages, Main.Abstract, Main.Published
FROM Main
WHERE (((Main.Authors) Like "*" & [Forms]![MForm]![Authors] & "*") AND ((Main.Title) Like "*" & [Forms]![MForm]![Title] & "*") AND ((Main.Language) Like "*" & [Forms]![MForm]![Language] & "*") AND ((Main.Pages) Like "*" & [Forms]![MForm]![nPages] & "*") AND ((Main.Abstract) Like "*" & [Forms]![MForm]![Abstract] & "*") AND ((Main.Published) Like "*" & [Forms]![MForm]![Published] & "*"))
GROUP BY Main.Authors, Main.Title, Main.Language, Main.Pages, Main.Abstract, Main.Published;
 
Thanks for writing a query for me....

Sorry for checking it once again.

I haven't seen anything regarding access in your query.

I tried your query by replacing my SQuery but still am able to delete the data from the search results

Is your above query will set only Read Only Permissions?
 
Last edited:

Users who are viewing this thread

Back
Top Bottom