Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Applying filter query to SubForm problem 1

Status
Not open for further replies.

Xyphious

MIS
May 6, 2008
42
GB
Hi all, i'm getting a headache trying to apply a filter to a datasheet subform in Access.

I have a main form called "Angola PO Errors Report" which holds my buttons for fetching the data etc. and a secondary form called "Ang_PO_errors" which gets its dataset from the main table (main table is also called Ang_PO_errors)

Now i'm trying to stick a button on the main form for filtering results in the datasheet subform, i've tried using a filter query that i've temporarily called "test filter query" but i can't seem to find out how to apply it to the subform via a command button on the main form, i'm an utter n00b to VB so if its a VB solution i may need some further help :/


Thanks in advance

______________________________________________

--If something's worth doing, its worth doing right - HST RIP--
 
Working with subforms can be a little tricky. That's because the main form looks at them as a control. This means you have to jump through a few more hoops.
Try this code to set the record source of the subform to the query you have already built.
Run this from a button on your main form.

me.subformName.Form.Recordsource = "queryName"

When you change the subform record source it requerys it, but that shouldn't be a problem.

Bobala
 
You sir, are a god amongst men!

That worked a treat, i was thinking this was going to me a nightmare!

Thanks you so much!

______________________________________________

--If something's worth doing, its worth doing right - HST RIP--
 
OK one further question on this, i now have all the filters implemented but i now need a button to remove them, i've tried the following after a quick googling but it didn't work:

Me.Ang_PO_errors.Form.FilterOn = False


Cheers

______________________________________________

--If something's worth doing, its worth doing right - HST RIP--
 
Ah, cracked it. Just did a select all query and this retrieves the original dataset.

______________________________________________

--If something's worth doing, its worth doing right - HST RIP--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top