472,328 Members | 1,031 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 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 10652
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...
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...
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...
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...
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#....
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...
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...
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). ...
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...
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 -...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

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.