Applyfilter macro looking in unbound field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I word the where clause of an applyfilter macro so that it looks in
the contents of some unbound fields in a form for its parameter values?

Cheers

Rhys
 
Take a look at your Access help for 'ApplyFilter Action'. It discusses
precisely what you seem to be asking for.
 
Well, I've now followed the instructions and have the following where clause

[Phase]=[Forms]![FRM School details]![Enter Phase] And [Region]=[Forms]![FRM
School details]![Enter Region] And [Activity]=[Forms]![FRM School
details]![Enter Account]

Where the [Enter *] are the unbound fields... but still no luck.

It keeps asking me to enter the value I want [Enter account] to be, and then
no matter what I enter it returns no results.

I probably should have mentioned that the unbound fields are in the form I
am filtering, and this is why I think it doesn't work.
 
What are the names of the controls on the forms that are supposed to be in
the place of the [Enter *]? The syntax '[Forms]![FRM School details]![Enter
*]' means that you are trying to get the value from a control named [Enter *]
on the form [FRM Schools detail]. Access is asking for the information that
would be in those fields if they were there.

If there is no such control on the form, then you need to determine the name
of the control containing the information that is supposed to be used. So for
example, if the contents of a control named txtPhase are supposed to go where
you have the expression [Enter Phase], you want to use [txtPhase]. Same
comment for others.

Good Luck!
--
Chaim


Rhysickle said:
Well, I've now followed the instructions and have the following where clause

[Phase]=[Forms]![FRM School details]![Enter Phase] And [Region]=[Forms]![FRM
School details]![Enter Region] And [Activity]=[Forms]![FRM School
details]![Enter Account]

Where the [Enter *] are the unbound fields... but still no luck.

It keeps asking me to enter the value I want [Enter account] to be, and then
no matter what I enter it returns no results.

I probably should have mentioned that the unbound fields are in the form I
am filtering, and this is why I think it doesn't work.

Chaim said:
Take a look at your Access help for 'ApplyFilter Action'. It discusses
precisely what you seem to be asking for.
 
Sorry - the [Enter *] was just my shorthand to save typing out {Enter Phase],
[Enter ...] again.

I have got the control names 100% correct - just double-checked - and I've
even put in the full reference for each control, so my SQL is:

[Forms]![FRM School details]![Phase]=[Forms]![FRM School details]![Enter
Phase] And
[Forms]![FRM School details]![Region]=[Forms]![FRM School details]![Enter
Region] And
[Forms]![FRM School details]![Account]=[Forms]![FRM School details]![Enter
Account]

Now it doesn't prompt me to input a parameter, but now no matter what I've
put in the controls it still returns no results every time. I'm mystified!!!



Chaim said:
What are the names of the controls on the forms that are supposed to be in
the place of the [Enter *]? The syntax '[Forms]![FRM School details]![Enter
*]' means that you are trying to get the value from a control named [Enter *]
on the form [FRM Schools detail]. Access is asking for the information that
would be in those fields if they were there.

If there is no such control on the form, then you need to determine the name
of the control containing the information that is supposed to be used. So for
example, if the contents of a control named txtPhase are supposed to go where
you have the expression [Enter Phase], you want to use [txtPhase]. Same
comment for others.

Good Luck!
--
Chaim


Rhysickle said:
Well, I've now followed the instructions and have the following where clause

[Phase]=[Forms]![FRM School details]![Enter Phase] And [Region]=[Forms]![FRM
School details]![Enter Region] And [Activity]=[Forms]![FRM School
details]![Enter Account]

Where the [Enter *] are the unbound fields... but still no luck.

It keeps asking me to enter the value I want [Enter account] to be, and then
no matter what I enter it returns no results.

I probably should have mentioned that the unbound fields are in the form I
am filtering, and this is why I think it doesn't work.

Chaim said:
Take a look at your Access help for 'ApplyFilter Action'. It discusses
precisely what you seem to be asking for.
--
Chaim


:

How do I word the where clause of an applyfilter macro so that it looks in
the contents of some unbound fields in a form for its parameter values?

Cheers

Rhys
 
I guess the next question for me to ask is: Does your table contain the
values in the fields that you think it does?

Stating what is probably obvious, your criteria means that all 3 of the
conditions have to be satisfied to retrieve any rows. IF any one of those
criteria are not fulfilled, the result will be an empty set.

Another approach might be to go to the Query Builder and create this query
there with hardcoded values in the criteria for these three fields and see
whether that returns what you expect.

Good Luck!
--
Chaim


Rhysickle said:
Sorry - the [Enter *] was just my shorthand to save typing out {Enter Phase],
[Enter ...] again.

I have got the control names 100% correct - just double-checked - and I've
even put in the full reference for each control, so my SQL is:

[Forms]![FRM School details]![Phase]=[Forms]![FRM School details]![Enter
Phase] And
[Forms]![FRM School details]![Region]=[Forms]![FRM School details]![Enter
Region] And
[Forms]![FRM School details]![Account]=[Forms]![FRM School details]![Enter
Account]

Now it doesn't prompt me to input a parameter, but now no matter what I've
put in the controls it still returns no results every time. I'm mystified!!!



Chaim said:
What are the names of the controls on the forms that are supposed to be in
the place of the [Enter *]? The syntax '[Forms]![FRM School details]![Enter
*]' means that you are trying to get the value from a control named [Enter *]
on the form [FRM Schools detail]. Access is asking for the information that
would be in those fields if they were there.

If there is no such control on the form, then you need to determine the name
of the control containing the information that is supposed to be used. So for
example, if the contents of a control named txtPhase are supposed to go where
you have the expression [Enter Phase], you want to use [txtPhase]. Same
comment for others.

Good Luck!
--
Chaim


Rhysickle said:
Well, I've now followed the instructions and have the following where clause

[Phase]=[Forms]![FRM School details]![Enter Phase] And [Region]=[Forms]![FRM
School details]![Enter Region] And [Activity]=[Forms]![FRM School
details]![Enter Account]

Where the [Enter *] are the unbound fields... but still no luck.

It keeps asking me to enter the value I want [Enter account] to be, and then
no matter what I enter it returns no results.

I probably should have mentioned that the unbound fields are in the form I
am filtering, and this is why I think it doesn't work.

:

Take a look at your Access help for 'ApplyFilter Action'. It discusses
precisely what you seem to be asking for.
--
Chaim


:

How do I word the where clause of an applyfilter macro so that it looks in
the contents of some unbound fields in a form for its parameter values?

Cheers

Rhys
 
Back
Top