473,397 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Beginner's help using count/Dcount function

Hope someone can help an Access beginner!

I've just started keeping my surgical logbook on access and it's a
simple flat-file affair. I have created several queries that will
list cases performed at different hospitals and reports based on the
queries to print out the relavent details.

What I would like to do is have a summary sheet in the Report Footer
section that lists a grid of each type of procedure performed as well
as the degree of involvement (1 to 4, depending on how much assistance
was required). I have tried using unbound text boxes and playing
around with the ControlSource doohickey to no avail. I thought it
would be something like:

=count([procedure]="Hip Arthroplasty" AND [code]="1"), repeated for
all of the different boxes with different values of procedure and
code....

....but I can't figure the exact syntax - dcount seems even more
difficult. I've tried my access book and various ng's/knowledge base
with no success.

I am sure there must be a simple answer but I'm going around in
circles - any help would be gratefully received!
Thanks in advance.
Simon Matthews
Nov 12 '05 #1
1 10785
Simon Matthews wrote:
Hope someone can help an Access beginner!

I've just started keeping my surgical logbook on access and it's a
simple flat-file affair. I have created several queries that will
list cases performed at different hospitals and reports based on the
queries to print out the relavent details.

What I would like to do is have a summary sheet in the Report Footer
section that lists a grid of each type of procedure performed as well
as the degree of involvement (1 to 4, depending on how much assistance
was required). I have tried using unbound text boxes and playing
around with the ControlSource doohickey to no avail. I thought it
would be something like:

=count([procedure]="Hip Arthroplasty" AND [code]="1"), repeated for
all of the different boxes with different values of procedure and
code....

...but I can't figure the exact syntax - dcount seems even more
difficult. I've tried my access book and various ng's/knowledge base
with no success.

I am sure there must be a simple answer but I'm going around in
circles - any help would be gratefully received!
Thanks in advance.
Simon Matthews


Dcount() is OK to get counts. Just remember if records don't exit,
DCount() returns null. So you might want to enter
NZ(Dcount("FieldNameToCount","Table","YourFilterCl ause"),0)

But it the grand scheme of things you need to hardcode the whole thing
and then the report turns into a PITA everytime something new comes
about, and then you spend time programming an Access report instead of
operating and filling out medical forms and your nurse quits because you
don't work on patients but computerprograms so...

I would suggest you create another report that lists the procedures and
counts. You can do this with a totals query as the report's recordsource.

I'm not sure of your skill level or how you are calling the report. I
usually call reports from a form. The form usually contains fields I
will be filtering on. Then in the OnOpen event of the report I might
set my filter. Ex:
Sub Report_OnOpen
Me.Filter = "Between #" & Forms!CallingForm!FromDate & "# And #" &
Forms!CallingForm!ToDate & "# And Code >=1 And Code <= 4"
Me.FilterOn = True

Or in the calling form, I might add a field and set it invisible. When
I press the button to call/open the report, I might create the filter. Ex:
Sub CommandPrint_Click
Me.FilterValue = "Between #" & Me!FromDate & "# And #" & Me.ToDate &
"# And Code >=1 And Code <= 4"
Docmd.OpenReport "YourReport"
End Sub
and in the OnOpen event enter
Me.Filter = Forms!CallingFormName!FilterValue
Me.FilterOn = True
OK, you can now call the filter for this sub report that lists your
summary. Now open the main report. Click on the sub-report control in
the toolbox and drop that in the ReportFooter band. Make sure the
ReportFooter band can grow (dbl-click on the footer band, view the
properties). BTW, there is no master/child link in your case.

What I usually do on a case like yours is to create the main report on a
query. I then add another column Ex:
Master : "M"
Now I open up the main report and from the menu press View/Sort&Group.
I create a group called Master and I slide it up to the top....it
becomes the first group. Then I tell Access that Master would like a
footer. And then I drop the subreport into that band, not the report
footer. Report and page footers print at the bottom of a page. I like
to keep my extra data near the area where the last record printed.

Good luck.

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Phil Powell | last post by:
Relevancy scores are normally defined by a MySQL query on a table that has a fulltext index. The rules for relevancy scoring will exclude certain words due to their being too short (minimum...
1
by: Simon Matthews | last post by:
Hope someone can help an Access beginner! I've just started keeping my surgical logbook on access and it's a simple flat-file affair. I have created several queries that will list cases...
5
by: Cro | last post by:
Hello Access Developers, I'd like to know if it is possible to perform a count in an expression that defines a control source. My report is based on a query. In my report, I want a text box to...
3
by: Melissa | last post by:
I have a sales report where the sales are grouped by district. The report is based on a query with criteria for sales date to get the sales in any specified date range. I have code in the Format...
8
by: Bri | last post by:
Greetings, I am using Eval() in a query with only limited success. If the text within the function contains a reference to a Field I get #ERROR#. I'll try and explain what I'm trying to do and...
5
by: Marshallp24 | last post by:
Hi, I need to be able to display a count of records in a message box but with a criteria of the just ones where there is a yes in a certain field. so the message box will pop up saying something...
2
by: Pete | last post by:
I need to create a single query (Not a SQL query) against a single table that counts the number of records in the table, where the single field "tmp" contains specific string values If the field...
3
by: davidwelli | last post by:
Hello, All help is appreciated, I'm struggling with the following. Using Access 2003 (front end) connecting to Oracle 7 database (back end). I'm trying to create a query in access that will...
3
by: Rebekkah | last post by:
I did a search but couldn't find a question similar to mine. I need to count the values in a textbox on a report and have the count subtotal in a group footer. But I need three different counts on...
3
by: MLH | last post by:
I put the following Count() From tblPHPDeveloperDoItems Where = True in a report footer. It's OK at compile time. But when the report runs - it gives me an error. Is there something I can do...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.