checking acct form... help with filter

G

Gary Miller

Brook,

I meant to put the Me.Filter = "" in the other section of
the If...Else...

What this does is clear the filter we created before so we
want to put that in the part that says If the Filter is On
lets turn it Off. Adding this line will then erase the
filter after we turn it off. Now if it is empty you should
get all of the records on your report.

Do me a favor. When you post back ( hopefully to tell me
that it worked ), start a new thread as this one is about as
long as we want it to get in the newsgroup.

Revised Code:
Private Sub cmdfilter_Click()
If Me.FilterOn = True Then
Me.FilterOn = False
Me.Filter = ""
Me!cmdfilter.Caption = "Unreconciled Checks Only "
Else
Me.Filter = "[Reconciled] = False AND ([accounttype] =
'checking' OR
[accounttype] = 'checking / Expense' or [accounttype] =
'Checking / Personal
Payment' or [accounttype] = 'Checking / Loan' or
[accounttype] = 'Checking /
Wire')"
Me.FilterOn = True
Me!cmdfilter.Caption = "Show All Entries"
End If
End Sub


--
Gary Miller
Sisters, OR



Brook said:
Gary,

I hope this doesn't post twice...

Here is the code I added to the filter button...

Private Sub cmdfilter_Click()
If Me.FilterOn = True Then
Me.FilterOn = False
Me!cmdfilter.Caption = "Unreconciled Checks Only "
Else
Me.Filter = "[Reconciled] = False AND ([accounttype] =
'checking' OR
[accounttype] = 'checking / Expense' or [accounttype] =
'Checking / Personal
Payment' or [accounttype] = 'Checking / Loan' or
[accounttype] = 'Checking /
Wire')"
Me.FilterOn = True
Me.Filter = ""
Me!cmdfilter.Caption = "Show All Entries"

End If
End Sub

the Me.Filter ="" doesn't change anything on the opening
of the report, and
the button never changes names between show all and
unreconciled captions?

the other portion of your suggestion works fine... as far
as the opening the
report with the Me.filter...

When I "Check" new records for reconcilation, will the
report show those?



Thanks,

Brook

Gary Miller said:
Brook,

I believe that this should work:

Use the control wizard to create a command button to open
your report. The wizard should generate code something
like
this:

Dim stDocName As String

stDocName = "Your Report Name"
DoCmd.OpenReport stDocName, acPreview

Now change the last line to add your form filter in the
'WHERE' section of the OpenReport command...

DoCmd.OpenReport stDocName, acPreview,,Me.Filter

This will use the same filter that the form is using. Now
you need to do one other thing so that you don't get a
filter when you want all of the records. Add this to the
end
of the previous code that we worked on with your command
button turning the filter on and off. In the section that
turns the filter off add this line to make the filter a
zero
length string after the line Me.FilterOn = False...

Me.Filter = ""

or

Me.Filter = Null to make it null

Now when the report goes to look at the filter when you
are
showing all the records there will be no filter string
and
you should get all of your records.

--
Gary Miller
Sisters, OR



message
Gary,

I do have one more question for you....

As you know I'm creating this in order to balance and
reconcile my
checking account. Is it possible to create / preview a
report based on just
the filtered data?

Or as I view "unreconciled transactions" and perform
my
reconcilations,
preview a report based on the undreconciled
transactions
filter as well as
the new reconciled records...?

Thanks,

Brook

:

Glad to help. Good luck with your project.

--
Gary Miller
Sisters, OR



message
Perfect...

Thank you..

And the reason for the different catagories is that
I
"store" all my account
data in one table.. for reporting to make it easier
as
well as seting up
reports for tax purposes.

Thanks again for all your help and patience!

Brook

:

Brook,

Sorry, my fault there. I must have been a in a bit
of
a
fog.
What needs to happen is to wrap the various Account
Type
options in parenthesis so that Reconciled = False
And
(Checking or Checking / Expense, etc...)

I would think that the best way to have structured
this
would actually to have had an additional field so
that
you
have Account Type = Checking, Savings, or whatever
and
then
have another field for Expenditure Type = Personal,
Expenditure, Loan, etc...

Here is the code with the paren's...Left paren
added
after
AND and the right one just before the last double
quote.

If Me.FilterOn = True Then
Me.FilterOn = False
Me!YourCommandButtonName.Caption = "Unreconciled
Checks
Only"
Else
Me.Filter = "[Reconciled] = True AND ([Account
Type] =
'Checking' OR [Account Type] = ' Checking / Expense
'
OR
[Account Type] = 'Checking / Loan')"
Me.FilterOn = True
Me!YourCommandButtonName.Caption = "Show All
Entries"
End If


--
Gary Miller
Sisters, OR



message
Gary,

ok... I set it up and here is my code. But when
I
run
the
filter its not
recognizing the Reconciled = False filter portion
of
the
code?

If I only have one Accouttype criteria then it
works,
but
when I add the
multiple accountype criteria's the Reconciled
filter
isn't
funtioning?

Any ideas?

Private Sub cmdfilter_Click()
If Me.FilterOn = True Then
Me.FilterOn = False
Me!cmdfilter.Caption = "Unreconciled Checks Only
"
Else
Me.Filter = "[Reconciled] = False AND
[accounttype]
=
'checking' OR
[accounttype] = 'checking / Expense' or
[accounttype] =
'Checking / Personal
Payment' or [accounttype] = 'Checking / Loan' or
[accounttype] = 'Checking /
Wire'"
Me.FilterOn = True
Me!cmdfilter.Caption = "Show All Entries"
End If
End Sub


Thanks,

Brook

:

Watch out for the line wrapping on the filter
line...

If Me.FilterOn = True Then
Me.FilterOn = False
Me!YourCommandButtonName.Caption =
"Unreconciled
Checks
Only"
Else
Me.Filter = "[Reconciled] = True AND [Account
Type]
=
'Checking' OR [Account Type] = ' Checking /
Expense
'
OR
[Account Type] = 'Checking / Loan'"
Me.FilterOn = True
Me!YourCommandButtonName.Caption = "Show All
Entries"
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top