Using a Filter on a Form to display forms with Check box not selected

  • Thread starter Thread starter weircolin
  • Start date Start date
W

weircolin

Hi

I have a check box on a form in order for me to say when something has
been carried out or not. I have created a querie for this purpose but
I would like to filter these records and show them on the form, is this
possible?

Thanks

Colin
 
Set the Filter of the form.

For example, if the yes/no field is named IsDone, you could show only the
ones where the box is checked using this code:
Me.Filter = "[IsDone] = True"
Me.FilterOn = True

To show the ones that are not done, change the first line to:
Me.Filter = "[IsDone] = False"

To have the forms always show only the undone ones, enter this into the
Criteria of your query under the IsDone field:
False
Then change the RecordSource property of the form to this query.
 
Hi Allen

Thats brilliant, works perfect. Just out of interest is there any way
that by clicking the filter button it could open a new window and
display the outstanding records there? Basically open the same form
again but running the filter?

Thanks

Colin
Allen said:
Set the Filter of the form.

For example, if the yes/no field is named IsDone, you could show only the
ones where the box is checked using this code:
Me.Filter = "[IsDone] = True"
Me.FilterOn = True

To show the ones that are not done, change the first line to:
Me.Filter = "[IsDone] = False"

To have the forms always show only the undone ones, enter this into the
Criteria of your query under the IsDone field:
False
Then change the RecordSource property of the form to this query.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

I have a check box on a form in order for me to say when something has
been carried out or not. I have created a querie for this purpose but
I would like to filter these records and show them on the form, is this
possible?
 
It's easy enough to open another different form with a filter:
DoCmd.OpenForm "Form2", WhereCondition:="[IsDone] = False"

But opening another instance of the same form is not as easy. You do that
with the New keyword, but there is no WhereCondition, so you have to find
another way to filter the new form. Typically you would do that by assigning
the WhereCondition string to a public variable before you open the New form,
and then use the Open event of the form to check the string, assign the
Filter, and clear the string. (From memory, this all works correctly for
forms, but does not work reliably for reports.)

But the new instance disappears as soon as the variable you used to create
it goes out of scope. You therefore need a way to manage these variables. I
suggest you create a collection, and use the hWnd of the form instances as
the key to the collection. For details of how to do that, see:
Managing Multiple Instances of a Form
at:
http://allenbrowne.com/ser-35.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi Allen

Thats brilliant, works perfect. Just out of interest is there any way
that by clicking the filter button it could open a new window and
display the outstanding records there? Basically open the same form
again but running the filter?

Thanks

Colin
Allen said:
Set the Filter of the form.

For example, if the yes/no field is named IsDone, you could show only the
ones where the box is checked using this code:
Me.Filter = "[IsDone] = True"
Me.FilterOn = True

To show the ones that are not done, change the first line to:
Me.Filter = "[IsDone] = False"

To have the forms always show only the undone ones, enter this into the
Criteria of your query under the IsDone field:
False
Then change the RecordSource property of the form to this query.

I have a check box on a form in order for me to say when something has
been carried out or not. I have created a querie for this purpose but
I would like to filter these records and show them on the form, is this
possible?
 
Hi Allen

Thanks for your help, I really appreciate it.

I got it showing the information on a similar form. Basically I made a
copy of the form and named it differently which saves any of the hassle
you spoke about. Seems to be working fine now.

I thought I would be able to print the details on each "page" on the
form but whenever I print it prints all the details.

Thanks again for your help.

Colin
Allen said:
It's easy enough to open another different form with a filter:
DoCmd.OpenForm "Form2", WhereCondition:="[IsDone] = False"

But opening another instance of the same form is not as easy. You do that
with the New keyword, but there is no WhereCondition, so you have to find
another way to filter the new form. Typically you would do that by assigning
the WhereCondition string to a public variable before you open the New form,
and then use the Open event of the form to check the string, assign the
Filter, and clear the string. (From memory, this all works correctly for
forms, but does not work reliably for reports.)

But the new instance disappears as soon as the variable you used to create
it goes out of scope. You therefore need a way to manage these variables. I
suggest you create a collection, and use the hWnd of the form instances as
the key to the collection. For details of how to do that, see:
Managing Multiple Instances of a Form
at:
http://allenbrowne.com/ser-35.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi Allen

Thats brilliant, works perfect. Just out of interest is there any way
that by clicking the filter button it could open a new window and
display the outstanding records there? Basically open the same form
again but running the filter?

Thanks

Colin
Allen said:
Set the Filter of the form.

For example, if the yes/no field is named IsDone, you could show only the
ones where the box is checked using this code:
Me.Filter = "[IsDone] = True"
Me.FilterOn = True

To show the ones that are not done, change the first line to:
Me.Filter = "[IsDone] = False"

To have the forms always show only the undone ones, enter this into the
Criteria of your query under the IsDone field:
False
Then change the RecordSource property of the form to this query.


I have a check box on a form in order for me to say when something has
been carried out or not. I have created a querie for this purpose but
I would like to filter these records and show them on the form, is this
possible?
 
You can put a command button on the form, and the command button can print
just the record in that form.

Details in this article:
Print the record in the form
at:
http://allenbrowne.com/casu-15.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi Allen

Thanks for your help, I really appreciate it.

I got it showing the information on a similar form. Basically I made a
copy of the form and named it differently which saves any of the hassle
you spoke about. Seems to be working fine now.

I thought I would be able to print the details on each "page" on the
form but whenever I print it prints all the details.

Thanks again for your help.

Colin
Allen said:
It's easy enough to open another different form with a filter:
DoCmd.OpenForm "Form2", WhereCondition:="[IsDone] = False"

But opening another instance of the same form is not as easy. You do that
with the New keyword, but there is no WhereCondition, so you have to find
another way to filter the new form. Typically you would do that by
assigning
the WhereCondition string to a public variable before you open the New
form,
and then use the Open event of the form to check the string, assign the
Filter, and clear the string. (From memory, this all works correctly for
forms, but does not work reliably for reports.)

But the new instance disappears as soon as the variable you used to
create
it goes out of scope. You therefore need a way to manage these variables.
I
suggest you create a collection, and use the hWnd of the form instances
as
the key to the collection. For details of how to do that, see:
Managing Multiple Instances of a Form
at:
http://allenbrowne.com/ser-35.html

Hi Allen

Thats brilliant, works perfect. Just out of interest is there any way
that by clicking the filter button it could open a new window and
display the outstanding records there? Basically open the same form
again but running the filter?

Thanks

Colin
Allen Browne wrote:
Set the Filter of the form.

For example, if the yes/no field is named IsDone, you could show only
the
ones where the box is checked using this code:
Me.Filter = "[IsDone] = True"
Me.FilterOn = True

To show the ones that are not done, change the first line to:
Me.Filter = "[IsDone] = False"

To have the forms always show only the undone ones, enter this into
the
Criteria of your query under the IsDone field:
False
Then change the RecordSource property of the form to this query.


I have a check box on a form in order for me to say when something
has
been carried out or not. I have created a querie for this purpose
but
I would like to filter these records and show them on the form, is
this
possible?
 
Hi Allen

Thanks for your help, its really appreciated. I don't think the last
example will be suitable for what I'm trying to do. Basically the
charity I work for collate issues and concerns from unpaid carers and
represent them on their behalf. Some of the issues are anonymous and
therefore I can't link the reference number to the names on our
database (where the autonumber field is assigned) so sometimes the ID
will be 0 and therefore print more than the one needed.

It isn't a big problem so not too worried about it. Thanks so much for
your help.

Take care

Colin
Allen said:
You can put a command button on the form, and the command button can print
just the record in that form.

Details in this article:
Print the record in the form
at:
http://allenbrowne.com/casu-15.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi Allen

Thanks for your help, I really appreciate it.

I got it showing the information on a similar form. Basically I made a
copy of the form and named it differently which saves any of the hassle
you spoke about. Seems to be working fine now.

I thought I would be able to print the details on each "page" on the
form but whenever I print it prints all the details.

Thanks again for your help.

Colin
Allen said:
It's easy enough to open another different form with a filter:
DoCmd.OpenForm "Form2", WhereCondition:="[IsDone] = False"

But opening another instance of the same form is not as easy. You do that
with the New keyword, but there is no WhereCondition, so you have to find
another way to filter the new form. Typically you would do that by
assigning
the WhereCondition string to a public variable before you open the New
form,
and then use the Open event of the form to check the string, assign the
Filter, and clear the string. (From memory, this all works correctly for
forms, but does not work reliably for reports.)

But the new instance disappears as soon as the variable you used to
create
it goes out of scope. You therefore need a way to manage these variables.
I
suggest you create a collection, and use the hWnd of the form instances
as
the key to the collection. For details of how to do that, see:
Managing Multiple Instances of a Form
at:
http://allenbrowne.com/ser-35.html

Hi Allen

Thats brilliant, works perfect. Just out of interest is there any way
that by clicking the filter button it could open a new window and
display the outstanding records there? Basically open the same form
again but running the filter?

Thanks

Colin
Allen Browne wrote:
Set the Filter of the form.

For example, if the yes/no field is named IsDone, you could show only
the
ones where the box is checked using this code:
Me.Filter = "[IsDone] = True"
Me.FilterOn = True

To show the ones that are not done, change the first line to:
Me.Filter = "[IsDone] = False"

To have the forms always show only the undone ones, enter this into
the
Criteria of your query under the IsDone field:
False
Then change the RecordSource property of the form to this query.


I have a check box on a form in order for me to say when something
has
been carried out or not. I have created a querie for this purpose
but
I would like to filter these records and show them on the form, is
this
possible?
 
Even if the person is unknown, you could still add an AutoNumber field to
the table so there is an automatically generated unique number for the
record?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.
Hi Allen

Thanks for your help, its really appreciated. I don't think the last
example will be suitable for what I'm trying to do. Basically the
charity I work for collate issues and concerns from unpaid carers and
represent them on their behalf. Some of the issues are anonymous and
therefore I can't link the reference number to the names on our
database (where the autonumber field is assigned) so sometimes the ID
will be 0 and therefore print more than the one needed.

It isn't a big problem so not too worried about it. Thanks so much for
your help.

Take care

Colin
Allen said:
You can put a command button on the form, and the command button can
print
just the record in that form.

Details in this article:
Print the record in the form
at:
http://allenbrowne.com/casu-15.html

Hi Allen

Thanks for your help, I really appreciate it.

I got it showing the information on a similar form. Basically I made a
copy of the form and named it differently which saves any of the hassle
you spoke about. Seems to be working fine now.

I thought I would be able to print the details on each "page" on the
form but whenever I print it prints all the details.

Thanks again for your help.

Colin
Allen Browne wrote:
It's easy enough to open another different form with a filter:
DoCmd.OpenForm "Form2", WhereCondition:="[IsDone] = False"

But opening another instance of the same form is not as easy. You do
that
with the New keyword, but there is no WhereCondition, so you have to
find
another way to filter the new form. Typically you would do that by
assigning
the WhereCondition string to a public variable before you open the New
form,
and then use the Open event of the form to check the string, assign
the
Filter, and clear the string. (From memory, this all works correctly
for
forms, but does not work reliably for reports.)

But the new instance disappears as soon as the variable you used to
create
it goes out of scope. You therefore need a way to manage these
variables.
I
suggest you create a collection, and use the hWnd of the form
instances
as
the key to the collection. For details of how to do that, see:
Managing Multiple Instances of a Form
at:
http://allenbrowne.com/ser-35.html

Hi Allen

Thats brilliant, works perfect. Just out of interest is there any
way
that by clicking the filter button it could open a new window and
display the outstanding records there? Basically open the same form
again but running the filter?

Thanks

Colin
Allen Browne wrote:
Set the Filter of the form.

For example, if the yes/no field is named IsDone, you could show
only
the
ones where the box is checked using this code:
Me.Filter = "[IsDone] = True"
Me.FilterOn = True

To show the ones that are not done, change the first line to:
Me.Filter = "[IsDone] = False"

To have the forms always show only the undone ones, enter this into
the
Criteria of your query under the IsDone field:
False
Then change the RecordSource property of the form to this query.


I have a check box on a form in order for me to say when
something
has
been carried out or not. I have created a querie for this
purpose
but
I would like to filter these records and show them on the form,
is
this
possible?
 
Hi Allen

Thats why ypu're the MVP! Hadn't thought of that. Done it now and
just hidden it on the form.

Thanks again for all your help.

Colin
Allen said:
Even if the person is unknown, you could still add an AutoNumber field to
the table so there is an automatically generated unique number for the
record?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.
Hi Allen

Thanks for your help, its really appreciated. I don't think the last
example will be suitable for what I'm trying to do. Basically the
charity I work for collate issues and concerns from unpaid carers and
represent them on their behalf. Some of the issues are anonymous and
therefore I can't link the reference number to the names on our
database (where the autonumber field is assigned) so sometimes the ID
will be 0 and therefore print more than the one needed.

It isn't a big problem so not too worried about it. Thanks so much for
your help.

Take care

Colin
Allen said:
You can put a command button on the form, and the command button can
print
just the record in that form.

Details in this article:
Print the record in the form
at:
http://allenbrowne.com/casu-15.html

Hi Allen

Thanks for your help, I really appreciate it.

I got it showing the information on a similar form. Basically I made a
copy of the form and named it differently which saves any of the hassle
you spoke about. Seems to be working fine now.

I thought I would be able to print the details on each "page" on the
form but whenever I print it prints all the details.

Thanks again for your help.

Colin
Allen Browne wrote:
It's easy enough to open another different form with a filter:
DoCmd.OpenForm "Form2", WhereCondition:="[IsDone] = False"

But opening another instance of the same form is not as easy. You do
that
with the New keyword, but there is no WhereCondition, so you have to
find
another way to filter the new form. Typically you would do that by
assigning
the WhereCondition string to a public variable before you open the New
form,
and then use the Open event of the form to check the string, assign
the
Filter, and clear the string. (From memory, this all works correctly
for
forms, but does not work reliably for reports.)

But the new instance disappears as soon as the variable you used to
create
it goes out of scope. You therefore need a way to manage these
variables.
I
suggest you create a collection, and use the hWnd of the form
instances
as
the key to the collection. For details of how to do that, see:
Managing Multiple Instances of a Form
at:
http://allenbrowne.com/ser-35.html

Hi Allen

Thats brilliant, works perfect. Just out of interest is there any
way
that by clicking the filter button it could open a new window and
display the outstanding records there? Basically open the same form
again but running the filter?

Thanks

Colin
Allen Browne wrote:
Set the Filter of the form.

For example, if the yes/no field is named IsDone, you could show
only
the
ones where the box is checked using this code:
Me.Filter = "[IsDone] = True"
Me.FilterOn = True

To show the ones that are not done, change the first line to:
Me.Filter = "[IsDone] = False"

To have the forms always show only the undone ones, enter this into
the
Criteria of your query under the IsDone field:
False
Then change the RecordSource property of the form to this query.


I have a check box on a form in order for me to say when
something
has
been carried out or not. I have created a querie for this
purpose
but
I would like to filter these records and show them on the form,
is
this
possible?
 
Back
Top