By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,508 Members | 2,949 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,508 IT Pros & Developers. It's quick & easy.

Applying filter to a subform

P: n/a
MS
I'm having trouble applying a filter to a subform.

I create a String in a Module based on various selections on the form.

Clicking a button on the "stand alone form" that changes the filter property
string to the string from the module works fine.

As soon as I put the form on the "main form" (thereby coverting it to a sub
form) things no longer work. Of course the record source for the sub form is
no longer a table or query, but the "source form" - this is presumably where
the problem lies.

How can I get the effect I need on the sub form?

Access 97

Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
MS

"MS" <Em***@Myemail.com> wrote in message
news:ST*****************@news-server.bigpond.net.au...
I'm having trouble applying a filter to a subform.

I create a String in a Module based on various selections on the form.

Clicking a button on the "stand alone form" that changes the filter
property string to the string from the module works fine.

As soon as I put the form on the "main form" (thereby coverting it to a
sub form) things no longer work. Of course the record source for the sub
form is no longer a table or query, but the "source form" - this is
presumably where the problem lies.

How can I get the effect I need on the sub form?

Access 97


Just had a look at Allen Brownes excellent site, and found....

Me.RecordSource = StrFltrWhatever

Seems to work fine.

Is this the best way to do it?
Nov 13 '05 #2

P: n/a

"MS" <Em***@Myemail.com> ha scritto nel messaggio
news:ST*****************@news-server.bigpond.net.au...
I'm having trouble applying a filter to a subform.

I create a String in a Module based on various selections on the form.

Clicking a button on the "stand alone form" that changes the filter
property string to the string from the module works fine.

As soon as I put the form on the "main form" (thereby coverting it to a
sub form) things no longer work. Of course the record source for the sub
form is no longer a table or query, but the "source form" - this is
presumably where the problem lies.

How can I get the effect I need on the sub form?

Access 97

Hi,
use the property "SourceObject" of sub form obiect how

This is an example:
http://support.microsoft.com/default...d=kb;de;D45175

Good Night
Gaspare
Nov 13 '05 #3

P: n/a

"Gaspare" <in**@studioieducation.com> ha scritto nel messaggio
news:js**********************@news3.tin.it...

"MS" <Em***@Myemail.com> ha scritto nel messaggio
news:ST*****************@news-server.bigpond.net.au...
I'm having trouble applying a filter to a subform.

I create a String in a Module based on various selections on the form.

Clicking a button on the "stand alone form" that changes the filter
property string to the string from the module works fine.

As soon as I put the form on the "main form" (thereby coverting it to a
sub form) things no longer work. Of course the record source for the sub
form is no longer a table or query, but the "source form" - this is
presumably where the problem lies.

How can I get the effect I need on the sub form?

Access 97

Hi,
use the property "SourceObject" of sub form obiect how

This is an example:
http://support.microsoft.com/default...d=kb;de;D45175

Good Night
Gaspare

Scuse me,
Do you want exchange the source of your sub-form by him self or by main
form?
Nov 13 '05 #4

P: n/a

"MS" <Em***@Myemail.com> ha scritto nel messaggio
news:ST*****************@news-server.bigpond.net.au...
I'm having trouble applying a filter to a subform.

I create a String in a Module based on various selections on the form.

Clicking a button on the "stand alone form" that changes the filter
property string to the string from the module works fine.

As soon as I put the form on the "main form" (thereby coverting it to a
sub form) things no longer work. Of course the record source for the sub
form is no longer a table or query, but the "source form" - this is
presumably where the problem lies.

How can I get the effect I need on the sub form?

Access 97

Hi,
(Q) I'm trying to restrict the records displayed in a subform by using
ApplyFilter on it, but it doesn't work. What's the right way to do it?

(A) The proper way is to change the Recordsource of the subform itself.
Using ApplyFilter on the subform will change the main form itself.

So either generate the SQL statement dynamically and assign that to
the Recordsource of the subform using a syntax like

strSQL="Select * from sometable where"
strSQL=strSQL & " someID=" & me!IDonMainForm
Me!SubFormName.Form.RecordSource=strSQL

or use predefined queries and swap the assigned names using the same syntax
as described above.

-----------

This example is good for you?

Gaspare


Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.