Ledger Question

G

Gerry

I downloaded the ledger database and I need help customizing a part of it. On
the main screen you have the main form. What I would like to do is create an
extra column with checkboxes. If a row is checked, I do not want that row to
be calculated within the total at the bottom.

Any suggestions on what to do?

Thanks

Gerry
 
R

Rob Parker

Hi Gerry,

You don't say where you downloaded the ledger database from, or what version
of Access you are using. But I'll assume that it's one of the three
templates databases available on the Microsoft Office site; further, since
two of those are Access 2007 templates, and I don't have Access 2007, I'll
tell you how to do this in the Access 2003 Accounts Ledger database (the
download file I got was 01017534.cab).

The first thing you need to do is to add a new field to the Transactions
table. I called mine "Include", and set the datatype to Yes/No. Save the
change to the table.

Next, open the Transaction Subform in design mode. Add the new field from
the detail section (the easiest way is to show the Field List, either via
the View menu or the button on the Form Design toolbar, and then just
drag/drop the field from the field list into the detail section of the
form). Save the change to the form's design and close.

Now, the main form (the Transaction form) will show the Include checkbox in
the datasheet grid (you may need to reduce the width of some columns to fit
on-screen, or else scroll to the right). If you set some of the Include
checkboxes, and then right-click in that field in the grid and chose "Filter
By Selection"; the form will then display only those records with the
checkbox set (or not set, if you chose Filter By Selection in a record where
the checkbox is cleared), and the totals (the Account Balance in the form
header, and the Withdrawal Amount and Deposit Amount in the form footer)
will automatically update.

Note that this will not affect the totals displayed on the Chart of
Transactions on the other tab of the Transaction form.

I would expect the design of the Access 2007 templates to be similar, and
the same modifications should work in an Access 2007 version; some of my
detail instruction will probably not apply exactly (eg. I suspect there is
no longer a View menu).

HTH,

Rob
 
G

Gerry

Rob,

I apologize for not being more specific. However you were correct that it
was Access 2003 verison.

Everything worked exactly the way I needed it to.

I have one more quick question. Is there a way to create a button for the
side menu which will do the filtering the way you describe it?

Thank you very much for your help. It is greatly appreciated!

Gerry
 
G

Gerry

Under the chart of transactions, do you know how to change the chart to show
deposits instead of withdrawals?

Thanks!

Gerry
 
R

Rob Parker

Hi Gerry,

Yes, it's possible to set/remove the filter via a button on the main form.
It involves just a little bit of code.

First, add a command button; name it cmdFilter, and set its caption to "Show
Include Only". Then add the following code to its Click event. To do that,
select [Event Procedure] in the On Click property box, click the ... button
to open the VBA editor, and cut/paste from this post into the code stub that
will be present - omit the "stub" lines which will already be present (hope
this isn't "teaching granny how to suck eggs, but I don't know how familiar
you are with Access and VBA coding).

Dim FilterState As Boolean

Private Sub cmdFilter_Click()
Me.Controls("Transactions Subform").Form.Filter = "Include = True"
If FilterState Then
Me.Controls("Transactions Subform").Form.FilterOn = False
cmdFilter.Caption = "Show Include Only"
FilterState = Not FilterState
Else
Me.Controls("Transactions Subform").Form.FilterOn = True
cmdFilter.Caption = "Show All"
FilterState = Not FilterState
End If
End Sub

Note that the declaration for FilterState (the line which start with Dim)
must be at the top of the code module, immediately below any Option
statements; this allows the form to "remember" the filter state while it's
open.

Note also that if you apply the filter via the right-click menu in the
subform, the caption on the button may get out of sync with the actual
filter state - but at most a couple of clicks will restore it. Also, if
you've applied any other filter to the subform, the button will remove it,
and filter only on the Include field.

HTH,

Rob
 
R

Rob Parker

Hi Again Gerry,

That one was a little trickier - the chart is actually a PivotChart view of
the data in the View Transactions With Account query; and I've never
actually used a PivotChart in anger, and rarely even played with them.
Anyhow, here's how to do it:

Open the Transactions Chart Subform; change to PivotTable view. Ensure that
the field list is open. Click on the Sum of WithdrawalAmount heading in the
value area and remove it, either by dragging it off the form or via Remove
in the right-click menu. Then drag the DepositAmount field from the field
list to the value area (which will now be showing No Totals). Change to
PivotChart view. To change the chart caption, ensure that the property
sheet is open, click on the title in the chart, and then change the Caption
in the Format tab of the property sheet. Close the subform, open the main
Transactions form, et voila!

HTH,

Rob
 
G

Gerry

Rob - YOU ARE THE MAN!

Thank you for all your help. It is greatly appreciated!

Rob Parker said:
Hi Gerry,

Yes, it's possible to set/remove the filter via a button on the main form.
It involves just a little bit of code.

First, add a command button; name it cmdFilter, and set its caption to "Show
Include Only". Then add the following code to its Click event. To do that,
select [Event Procedure] in the On Click property box, click the ... button
to open the VBA editor, and cut/paste from this post into the code stub that
will be present - omit the "stub" lines which will already be present (hope
this isn't "teaching granny how to suck eggs, but I don't know how familiar
you are with Access and VBA coding).

Dim FilterState As Boolean

Private Sub cmdFilter_Click()
Me.Controls("Transactions Subform").Form.Filter = "Include = True"
If FilterState Then
Me.Controls("Transactions Subform").Form.FilterOn = False
cmdFilter.Caption = "Show Include Only"
FilterState = Not FilterState
Else
Me.Controls("Transactions Subform").Form.FilterOn = True
cmdFilter.Caption = "Show All"
FilterState = Not FilterState
End If
End Sub

Note that the declaration for FilterState (the line which start with Dim)
must be at the top of the code module, immediately below any Option
statements; this allows the form to "remember" the filter state while it's
open.

Note also that if you apply the filter via the right-click menu in the
subform, the caption on the button may get out of sync with the actual
filter state - but at most a couple of clicks will restore it. Also, if
you've applied any other filter to the subform, the button will remove it,
and filter only on the Include field.

HTH,

Rob

Gerry said:
Rob,

I apologize for not being more specific. However you were correct that it
was Access 2003 verison.

Everything worked exactly the way I needed it to.

I have one more quick question. Is there a way to create a button for the
side menu which will do the filtering the way you describe it?

Thank you very much for your help. It is greatly appreciated!

Gerry
 
G

Gerry

Hi Rob,

I have a different kind of question. It has to do with Macros.

On the main transaction form (when opened), there is button linked to a set
o f reports. I would like to create another button that links to a specific
set of reports but I am not sure how to do that. Any suggestions?

Thanks!

Gerry

Gerry said:
Rob - YOU ARE THE MAN!

Thank you for all your help. It is greatly appreciated!

Rob Parker said:
Hi Gerry,

Yes, it's possible to set/remove the filter via a button on the main form.
It involves just a little bit of code.

First, add a command button; name it cmdFilter, and set its caption to "Show
Include Only". Then add the following code to its Click event. To do that,
select [Event Procedure] in the On Click property box, click the ... button
to open the VBA editor, and cut/paste from this post into the code stub that
will be present - omit the "stub" lines which will already be present (hope
this isn't "teaching granny how to suck eggs, but I don't know how familiar
you are with Access and VBA coding).

Dim FilterState As Boolean

Private Sub cmdFilter_Click()
Me.Controls("Transactions Subform").Form.Filter = "Include = True"
If FilterState Then
Me.Controls("Transactions Subform").Form.FilterOn = False
cmdFilter.Caption = "Show Include Only"
FilterState = Not FilterState
Else
Me.Controls("Transactions Subform").Form.FilterOn = True
cmdFilter.Caption = "Show All"
FilterState = Not FilterState
End If
End Sub

Note that the declaration for FilterState (the line which start with Dim)
must be at the top of the code module, immediately below any Option
statements; this allows the form to "remember" the filter state while it's
open.

Note also that if you apply the filter via the right-click menu in the
subform, the caption on the button may get out of sync with the actual
filter state - but at most a couple of clicks will restore it. Also, if
you've applied any other filter to the subform, the button will remove it,
and filter only on the Include field.

HTH,

Rob

Gerry said:
Rob,

I apologize for not being more specific. However you were correct that it
was Access 2003 verison.

Everything worked exactly the way I needed it to.

I have one more quick question. Is there a way to create a button for the
side menu which will do the filtering the way you describe it?

Thank you very much for your help. It is greatly appreciated!

Gerry

:

Hi Gerry,

You don't say where you downloaded the ledger database from, or what
version
of Access you are using. But I'll assume that it's one of the three
templates databases available on the Microsoft Office site; further,
since
two of those are Access 2007 templates, and I don't have Access 2007,
I'll
tell you how to do this in the Access 2003 Accounts Ledger database (the
download file I got was 01017534.cab).

The first thing you need to do is to add a new field to the Transactions
table. I called mine "Include", and set the datatype to Yes/No. Save
the
change to the table.

Next, open the Transaction Subform in design mode. Add the new field
from
the detail section (the easiest way is to show the Field List, either via
the View menu or the button on the Form Design toolbar, and then just
drag/drop the field from the field list into the detail section of the
form). Save the change to the form's design and close.

Now, the main form (the Transaction form) will show the Include checkbox
in
the datasheet grid (you may need to reduce the width of some columns to
fit
on-screen, or else scroll to the right). If you set some of the Include
checkboxes, and then right-click in that field in the grid and chose
"Filter
By Selection"; the form will then display only those records with the
checkbox set (or not set, if you chose Filter By Selection in a record
where
the checkbox is cleared), and the totals (the Account Balance in the form
header, and the Withdrawal Amount and Deposit Amount in the form footer)
will automatically update.

Note that this will not affect the totals displayed on the Chart of
Transactions on the other tab of the Transaction form.

I would expect the design of the Access 2007 templates to be similar, and
the same modifications should work in an Access 2007 version; some of my
detail instruction will probably not apply exactly (eg. I suspect there
is
no longer a View menu).

HTH,

Rob

I downloaded the ledger database and I need help customizing a part of
it.
On
the main screen you have the main form. What I would like to do is
create
an
extra column with checkboxes. If a row is checked, I do not want that
row
to
be calculated within the total at the bottom.

Any suggestions on what to do?

Thanks

Gerry
 
R

Rob Parker

Hi Gerry,

First off, let me say that I never use Macros - I build the functionality
that I need via VBA code.

Next, one of the things that I find frustrating with the Microsoft example
databases is the total lack of any naming conventions; it often takes a
while to work out exactly what's going on and how things work because
objects have names that tell you nothing about what they are. I mention
this because I was irked by it when trying to figure out how the existing
macro for viewing reports works; if you want some background reading on
naming conventions (the commonest is the Leszynski Naming Convention (LNC)),
try the following link: http://www.helenfeddema.com/files/accarch75.zip
The zipfile includes a free add-in that you can install to help you rename
existing objects and form controls, and a descriptive article (including
installation instructions). Add to that the use of names with spaces -
another irk, and non-standard practice among all serious developers.

Now, to the nitty-gritty: I suggest that you do this by simply copying
what's already existing in the Accounts Ledger database, and modifying as
appropriate. I don't intend to simply say "do a, b, c, ...", since you
won't learn anything from that; instead, I'll describe roughly what's
involved (in doing it via macros, as is presently done in the Ledger
database), and leave it to you to play.

The underlying objects for the existing View Reports button on the
Transactions form are:

1. the "View Reports" form, which opens when the button on the Transactions
form is clicked. This form also contains a non-visible text box which
contains the filter string (the Where Condition in the macros - see below)
built from the selected option button and the two date textbox controls in
the grpFilterOptions control, via a Choose expression. Controls which need
to respond to events (the click event of the two command buttons, and the
double-click event of the list box) have the names of the macro entered into
the event property for the control (note the syntax, with a dot between the
macro object name and the macro name).

2. a table containing the names of the reports (named "Reports"). This has
three fields, but it doesn't really seem to need them all; there's an
autonumber field ReportID which is not really necessary, a ReportName field
which contains the names of the various reports (the entries must match
exactly the names of the reports as shown in the Reports tab of the database
window), and a ReportDesc field which is empty for all records.

2. a query (named "Add or Delete Reports") which is used as the rowsource
for the listbox on the "View Reports" form. This query selects the
ReportName field from the "Reports" table. I guess they've done it this way
to simplify things; they could equally as well have set (in the Data tab of
the Properties dialog box for the listbox control on the "View Reports"
form) the rowsource to the name of the table, set the Bound Column to 2 (the
second field in the table), and (on the Format tab) set the column count to
2 and the column widths to 0; 2.5 - this will have the effect of hiding the
first field from the table.

3. a macro (named "View Reports Macro") which contains details of the
various actions to be performed on various events. As I said earlier, I
never use macros, so I'm not au-fait with their intricacies, but what's here
all seems pretty simple. The "View Reports Macro" object contains three
separate macros, and for each one, the associated objects/parameters are
shown in the bottom section of the macro design grid when the row for the
parameter is selected. Note that an entry such as "=[Forms]![View
Reports]![lstReports]" (in Report Name for an OpenReport action) means that
the report which opens is the one whose name is given as the selected item
in the lstReports control on the View reports form.

4. the various reports. Note that the report designs contain filter
parameters displayed in the header.

5. the "Reports" form, which is used to enter/edit/delete entries in the
"Reports" table - see what I mean about confusing object names; I'd have
called these "frmReports" and "tblReports" respectively.

So, to reproduce this, you'll need to create your own version of each of
these objects (you could exclude the query, if you change the properties of
the listbox on your new version of the "View Reports" form), populate your
new table (either directly or via a new frmCustomReports), set the
appropriate properties for the controls and refer to the appropriate objects
in your new macro object, containing similar macros to those in the current
View Reports Macros object.

I suggest that, if you are at all serious about being able to build or
customise an Access database application, that you get one (or more) good
reference texts for the version of Access that you are using, and study
carefully. Go to a bookshop and browse; find something that you can
understand, but which is neither too simple nor too complicated (and that
will be a personal thing, depending on your current knowledge/background).
Access does have a pretty steep learning curve, and it's likely to be
frustrating to start with. But you'll get there.

Good luck, and HTH,

Rob

PS. If you have further questions - and I'm sure you will - I suggest you
post as new questions, rather than continuing this thread. You'll likely
get more (and, since you're probably on the other side of the world to me,
faster) responses from a large group of people ready to assist. You should
also consider posting to a specific subgroup in the microsoft.public.access
heirarchy appropriate to each question; eg. there's a .macros group, which I
don't ever look at, but which might be very useful for you if you have
problems with macros.
Hi Rob,

I have a different kind of question. It has to do with Macros.

On the main transaction form (when opened), there is button linked to
a set o f reports. I would like to create another button that links
to a specific set of reports but I am not sure how to do that. Any
suggestions?

Thanks!

Gerry
<snip>
 

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

Similar Threads


Top