Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / August 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
weircolin@googlemail.com - 09 Aug 2006 09:29 GMT
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
Allen Browne - 09 Aug 2006 09:40 GMT
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.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
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?
weircolin@googlemail.com - 09 Aug 2006 09:53 GMT
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
> Set the Filter of the form.
>
[quoted text clipped - 20 lines]
> > I would like to filter these records and show them on the form, is this
> > possible?
Allen Browne - 09 Aug 2006 11:45 GMT
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

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Hi Allen
>
[quoted text clipped - 25 lines]
>> > I would like to filter these records and show them on the form, is this
>> > possible?
weircolin@googlemail.com - 09 Aug 2006 15:53 GMT
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
> It's easy enough to open another different form with a filter:
>     DoCmd.OpenForm "Form2", WhereCondition:="[IsDone] = False"
[quoted text clipped - 49 lines]
> >> > I would like to filter these records and show them on the form, is this
> >> > possible?
Allen Browne - 09 Aug 2006 16:36 GMT
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

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Hi Allen
>
[quoted text clipped - 68 lines]
>> >> > this
>> >> > possible?
weircolin@googlemail.com - 10 Aug 2006 09:31 GMT
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
> You can put a command button on the form, and the command button can print
> just the record in that form.
[quoted text clipped - 81 lines]
> >> >> > this
> >> >> > possible?
Allen Browne - 10 Aug 2006 09:44 GMT
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?

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Hi Allen
>
[quoted text clipped - 104 lines]
>> >> >> > this
>> >> >> > possible?
weircolin@googlemail.com - 10 Aug 2006 11:08 GMT
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
> 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
[quoted text clipped - 112 lines]
> >> >> >> > this
> >> >> >> > possible?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.