Date-range specific report with counted results of combo box selections

Hi there,
I'm a novice with Access, but am currently setting up a patient
database for an NGO in India that I'm volunteering with. The primary
reason for the database is to collect statistics quarterly. It is a
simple database with one table that collects patient data from simple
forms with some fields having combo boxes.

Ultimately I want to generate reports that will show a summary of
'counts' of various fields for a given period.  For example:

In the table I have a combo box for where the person came from, with
several options including - "Pick up Y. Bazar", "Came Self" &
"Referred".  I also have fields with tick boxes, e.g. HIV positive is
either ticked or not.  On the report I would like it to look like the
following:

>From 01/01/07 - 31/03/07

Came from:  	 Pick up Y. Bazar   	(count)
		        Came Self		  (count)
		        Referred		    (count)

HIV positive:       (count)

Firstly, what kind of queries to I need to make to do this, and how do
I make a report look like the above?  I am familiar with how to make a
query defined by a date range and how to use criteria to limit to one
result from a combo box etc.

I have searched the group to try and work this out but have had no
luck, any pointers anyone could give would be appreciated - I'm
possibly getting a bit out of my depth here.

Cheers,
Erin.

0
Erin
4/18/2007 7:36:38 AM
access 16762 articles. 2 followers. Follow

6 Replies
939 Views

Similar Articles

[PageSpeed] 21

Hi Erin,

Welcome to the world of Access development.  Early on in your
experiences in these newsgroups you'll probably find that each time
you posit an issue the responses seem to come back talking about
something else.  Such will be the case here.  It's all intended to
help you and those in like situations.

First, you've been sucked in by Microsoft regarding Lookup Fields in
table design.  Get rid of them before you've tried to layer other
functionality on them.  Remove them and let each table stand alone
rather than trying to store a relationship in the table.  Don't
confuse Lookup Fields (a bad thing) with Lookup Tables, a very good
and useful thing.  Visit www.mvps.org/access for edifying discussion.

Next, you've made a decision regarding your schema (just one
table....) that just doesn't make sense.    The topics of analysis and
design aren't covered well in the Microsoft documentation so don't
restrict your attempts to learn about them to just the MS sources.  A
lot of good information comes out in these newsgroups but TablesDesign
is particularly on target.

The more thoroughly you complete the early phases of an application,
the more successful and easy to maintain and to enhance that
application will be..  To simplify: there should be one table for each
entity type within your application.  Every instance of a given entity
should be recorded in the single table provided within your
application for that entity type.  One common mistake that people make
in designing their data is to create a new table for each instance of
what is really a data attribute.  Don't create tables based on the
year, for example..  Just include a date field in your table and the
year is now something on which you can sort and differentiate
records..

Make ample use of Lookup Tables - those are simple tables that serve
to hold lists of data.  For example you might have a table, tblDisease
in which every diagnosable disease within the scope of your
application is listed.  You start with a huge list and then add
diseases as they are encountered for the first time.  That will save
lots of typing with the chances for typographical errors.  Just point
and click to select the diagnosed disease and get to what ever else
your schedule demands.

New developers who are serious about getting it "right" will do well
to lurk Microsoft.public.access.tablesdesign and
microsoft.public.access.gettingstarted.  Also, visit
www.mvps.org/access frequently  You'll gain new insights by reading
there.  Also, new stuff keeps appearing.  Make intelligent efforts to
learn and the rewards will come.  Access has a long, steep learning
curve.  You aren't stupid.  You're taking on the world of relational
database design and development and Access at the same time.  It's a
load.


By the way, if your NGO or any of which you are aware are providing
free medical services to folks then you and they might want to decode
my email and get in touch with me.  I have an Access based Medical
Transcriber productivity tool that I make available to free clinics at
no charge.  People and organizations who charge the recipients for
their services don't get the freebies.

HTH
-- 
-Larry-
--

"Erin" <erin.ot@gmail.com> wrote in message
news:1176881798.959236.272930@o5g2000hsb.googlegroups.com...
> Hi there,
> I'm a novice with Access, but am currently setting up a patient
> database for an NGO in India that I'm volunteering with. The primary
> reason for the database is to collect statistics quarterly. It is a
> simple database with one table that collects patient data from
simple
> forms with some fields having combo boxes.
>
> Ultimately I want to generate reports that will show a summary of
> 'counts' of various fields for a given period.  For example:
>
> In the table I have a combo box for where the person came from, with
> several options including - "Pick up Y. Bazar", "Came Self" &
> "Referred".  I also have fields with tick boxes, e.g. HIV positive
is
> either ticked or not.  On the report I would like it to look like
the
> following:
>
> >From 01/01/07 - 31/03/07
>
> Came from:  Pick up Y. Bazar   (count)
>         Came Self   (count)
>         Referred     (count)
>
> HIV positive:       (count)
>
> Firstly, what kind of queries to I need to make to do this, and how
do
> I make a report look like the above?  I am familiar with how to make
a
> query defined by a date range and how to use criteria to limit to
one
> result from a combo box etc.
>
> I have searched the group to try and work this out but have had no
> luck, any pointers anyone could give would be appreciated - I'm
> possibly getting a bit out of my depth here.
>
> Cheers,
> Erin.
>


0
Larry
4/18/2007 9:57:58 AM
On 18 Apr 2007 00:36:38 -0700, Erin <erin.ot@gmail.com> wrote:

>Hi there,
>I'm a novice with Access, but am currently setting up a patient
>database for an NGO in India that I'm volunteering with. The primary
>reason for the database is to collect statistics quarterly. It is a
>simple database with one table that collects patient data from simple
>forms with some fields having combo boxes.
>
>Ultimately I want to generate reports that will show a summary of
>'counts' of various fields for a given period.  For example:
>
>In the table I have a combo box for where the person came from, with
>several options including - "Pick up Y. Bazar", "Came Self" &
>"Referred".  I also have fields with tick boxes, e.g. HIV positive is
>either ticked or not.  On the report I would like it to look like the
>following:
>
>>From 01/01/07 - 31/03/07
>
>Came from:  	 Pick up Y. Bazar   	(count)
>		        Came Self		  (count)
>		        Referred		    (count)
>
>HIV positive:       (count)
>
>Firstly, what kind of queries to I need to make to do this, and how do
>I make a report look like the above?  I am familiar with how to make a
>query defined by a date range and how to use criteria to limit to one
>result from a combo box etc.

A Totals query will do this. Create a query based on your table; select the
"Came From" field and some field which will never be null - the table's
Primary Key is a good choice. Also select the date field (and any other field
that you want to use for criteria).

Change the query to a Totals query by clicking the Greek Sigma icon (looks
like a sideways M). A new row labeled Totals will appear in the query grid.

Leave the default Group By on the "Came From" field; change it to Count on the
primary key field; and change it to "Where" on the date field. Put

BETWEEN [Enter start date:] AND [Enter end date:]

on the Criteria line under the date field.

Base your report on this Query.

You may need a report with two or more subreports if you're displaying
unrelated sets of data (such as HIV positive) - I'm sure there will be overlap
between the "came from" patients and the HIV positive patients.

             John W. Vinson [MVP]
0
John
4/18/2007 4:56:20 PM
Thanks to you both for your input, you have certainly opened my eyes
to the complexities of what I am doing!

Using look-up tables does seem like the better alternative to combo
boxes - should I only have one field in each look-up table with the
list of possibilities or should I have an autonumber associated with
each?

Now that I have looked into it, I am struggling with working out how
to change from having many fields in my original table (i.e. for each
diagnosis flag there is a yes/no field) to linking a table where
multiple diagnoses could be selected. I would want to have a list of
common diagnoses (the ones we want for statistical purposes)  and an
"other" option that could also have a description.  We may add a few
common diagnoses to the list in the future, but would not put every
new one in.

Larry - I have tried to send an email but it bounced back to me. As it
is (and I know this probably isn't the appropriate place to discuss
this), the NGO I'm with provides all medical services for free. Most
of the patients are picked up off the street and are often destitute.
I am interested in knowing more about your Access based tool, though I
am not sure what it is for? Would like to hear from you about it if
possible.

Cheers and many thanks again, Erin.

0
Erin
4/19/2007 9:55:04 AM
On 19 Apr 2007 02:55:04 -0700, Erin <erin.ot@gmail.com> wrote:

>Thanks to you both for your input, you have certainly opened my eyes
>to the complexities of what I am doing!
>
>Using look-up tables does seem like the better alternative to combo
>boxes - should I only have one field in each look-up table with the
>list of possibilities or should I have an autonumber associated with
>each?

NO. "Lookup fields" *ARE* combo boxes, not an alternative to combo boxes. See 
http://www.mvps.org/access/lookupfields.htm for a critique of the Lookup Field
misfeature.

If you're using table datasheets for data entry - *DON'T*. Tables are *not*
designed for this purpose. You can and should certainly use Combo Boxes
appropriately - on Forms, not in tables. If the value being looked up is
reasonably short and stable, then you don't need an Autonumber; it's perfectly
reasonable to have a one-field table with the list of valid values, and use
that combo as the rowsource of a combo box on a Form to store data into a Text
field in your table.

>Now that I have looked into it, I am struggling with working out how
>to change from having many fields in my original table (i.e. for each
>diagnosis flag there is a yes/no field) to linking a table where
>multiple diagnoses could be selected. I would want to have a list of
>common diagnoses (the ones we want for statistical purposes)  and an
>"other" option that could also have a description.  We may add a few
>common diagnoses to the list in the future, but would not put every
>new one in.

This is a very typical many to many relationship: each Patient can have one or
more diagnoses, and each diagnosis can apply to one or more patient. The
normalized way to handle this involves three tables:

Patients
  PatientID <autonumber or other unique linking field>
  Surname
  Forename
  <other biographical and identifying information as appropriate>

Diagnoses
  DiagnosisCode <there are standard medical codes available, or use an
autonumber>
  Diagnosis 
 
PatientDiagnoses
  PatientID <who has this diagnosis>
  DiagnosisCode <what do they have>
  <other fields about this patient's condition with regard to this diagnosis,
e.g. severity, date diagnosed, comments, ...>
  <the Comments field could contain the "other diagnosis" if you choose to
have a DiagnosisCode for "Other">


Rather than forty *fields* for forty conditions, you would have as many
*records* as the patient needs. This makes it much easier to add or edit
conditions without changing your table structure, and you can very easily run
Totals queries joining the three tables to get statistical frequency.


OT but... your operation and your patients are in my prayers.

             John W. Vinson [MVP]
0
John
4/19/2007 4:49:08 PM
Thanks again.

I have never thought to enter data directly into the data sheet, but
have rather set up forms for this (the people who will be entering
data are at the moment computer illiterate & I want it as simple as
possible!). I would love further clarification/advice on the following
if you could offer it:

>  it's perfectly
> reasonable to have a one-field table with the list of valid values, and use
> that combo as the rowsource of a combo box on a Form to store data into a Text
> field in your table.

I'm confused about how to 'store data into a Text field in your
table'  -- how do I get the resulting text from a combo box on a form
(that is linked to the one-field table) to end up as text in a table
and not a combo box?

Cheers yet again... Erin.





0
Erin
4/21/2007 6:31:28 AM
On 20 Apr 2007 23:31:28 -0700, Erin <erin.ot@gmail.com> wrote:

>>  it's perfectly
>> reasonable to have a one-field table with the list of valid values, and use
>> that combo as the rowsource of a combo box on a Form to store data into a Text
>> field in your table.
>
>I'm confused about how to 'store data into a Text field in your
>table'  -- how do I get the resulting text from a combo box on a form
>(that is linked to the one-field table) to end up as text in a table
>and not a combo box?

Have a Text field in the table (STATE, say, in an address).

Have a Combo Box based on a query

SELECT [StateCode] FROM tblStates ORDER BY StateCode;

with values of StateCode like AK, AL, and so on.

On the Form set the Control Source of the combo to STATE.

If you're assuming that a combo box must store a numeric value... it needn't.
It will store whatever field is in its Bound Column into the Control Source
field that you specify in the combo's properties.

Also, it is NOT necessary to have a combo box in the Table in order to use a
combo box on a Form. That's one way to do it, sure, but you can very easily
use the toolbox combo box tool to put a combo on a form, independently of
whether it's a Lookup Field in a table or not.

             John W. Vinson [MVP]
0
John
4/21/2007 9:13:37 PM
Reply:

Similar Artilces:

filter by date and action
I have a table with three columns: Name Date Action Fred Today this Fred Today this Fred Today that Wilma Today this I want to sort by name and by date, but only if 'this' was done more than once on the same day, and not if 'that' was done on the same day,They have to perform this more than once, and they cannot have performed that on the same day. If not in excel, mssql maybe? Thanks, Harry On Aug 18, 1:53=A0pm, Harry <hamac...@gmail.com> wrote: > I have a table with three co...

Calculate Years/Months Between Dates and then Average
We are using the formula =DATEDIF(A1,NOW(),"y") & "." & DATEDIF(A1,NOW(),"ym") to calculate the years and months from an employee hire date. Is there an easy way to average the years and months for a group of employees with the results of that formula? You could use: =AVERAGE(A1:A10*1) Array-entered, meaning press ctrl-shift-enter. But you could also just change your current formula to: =1*(DATEDIF(A1,NOW(),"y") & "." & DATEDIF(A1,NOW(),"ym")) Then just use: =AVERAGE(A1:A10) which is *not* array-entered. ...

copy range to multiple workbooks
Hi all, I have a good search around but have been unable to find what I am after, that being - I wish to copy a range - V1 to BK30 - from a single worksheet in what is my master workbook -"new_rtgs"- to any number of other workbooks which are copies made daily of the master workbook & which contain up to 30 worksheets. Basicaly this range contains formulas which analyse data I import to Colums A thru U. All the workbooks I need to copy to are housed in the same directory & are named by date - eg aug_01, aug_02 etc. Thanks in advance for any help provided. -- davez ---...

Keeping a range constant when inserting rows
Hello, I'm trying to keep a range of cells constant within a function when I insert a row (e.g. average(a1:a6) becomes average(a1:a7) but I want it to keep the a1:a6 range). Even if I use absolute cell references ($a$1:$a$6), it doesn't help. I would greatly appreciate any ideas. Thanks, Jeff Jeff, In your formula, use: =AVERAGE(INDIRECT("A1:A6")) Absolute cell references (dollar signs) do one thing only: They keep any copies you make of the cell references from changing relatively as they're copied. They still change when the cells to which they refer are m...

LF displays as square box in cell
I have some cells with text where the LF (line feed) displays as a square box. Searching the web for this scenario suggests that turning on Word Wrap should eliminate this display but it does not in my case. Also, not all LFs in the cell display as a square box and one of my co- workers does not see the behaviour when he opens the file on his PC (another co-worker does see the problem). The text has been downloaded from a SQL query and I'm using Excel 2007/ WinXP. Any suggestions on how to clean up the view of the cells with this text? On Thu, 17 Feb 2011 08:20:38 -0800 (PST), John <...

Transaction Date VS Business Date
Our accounting department needs/wants to have all RMS SO reporting by business date opposed to transaction date. Usually these are the same unless you have sales and batches that close after midnight. For our store I would like to set 3 a.m. as the business day closing time. So when I run any type of reports I would like to get the information for a business date (range) starting at 3 a.m. till 3 a.m. the next day. I guess I could accomplish this by subtracting 3 hours from all the transaction (date and) times but I would have to do this for every single report which would be a lot of ...

Restrict Data Entry in Combo Box
Is there any way to prevent a user from typing into a Combo Box and onl selecting items by selecting them from the drop down menu? I'm tryin to reduce data entry errors from the user. Thanks a lot, Ripa -- Message posted from http://www.ExcelForum.com Hi If your list is "fixed" could you not just create a list in a worksheet and use Data > Validation > Allow > List (Select your list range). It produces a drop-down list similar to your combo-box and the user can't change any entries. >-----Original Message----- >Is there any way to prevent a user from ...

Unexpected feature when working with Reporting Services
Using a previous version of Internet Explorer (6.0.2800.1106CO) we generate a Report from an aspx page (using Reporting Services). Then the report was showed in a popup page. The Reporting Services can export a report to Excel, so we used to do this and an Excel sheet opened, and the previous page (the 'popup') kept open. Now we've upgraded the Explorer to the 6.0.2900.2180.xpsp_sp2_rtm.040803-2158CO version and when exporting the report to an excel, the popup closes... we don't know why... can anybody explain me how to resolve this? Thanks in advance. has IE enabled...

Post Dated Checks
I had to prepare some post dated checks and we did not have fiscal periods set up yet to match the dates of the checks. Currently the check batches are waiting to be posted. What is the best way to handle post dated checks? If I create new fiscal years to match these dates, I will end up having 4 Open years. Is this the only way to do it? You can manage post dated checks in Microsoft Dynamics GP with the Payment Document Management module available on the Feature Pack 1 DVD image. For more info, take a look at MVP Mohammad Daoud's post on the subject at: https://communit...

Remove "Date: Yesterday" or "Date: Monday" from Outlook Inbox?
Outlook mail inbox now has headers that tell you what day the the email was sent. I find this visually annoying. Each emailalready has the time and day it was sent. I don't need the daily titles in the midst of the list of emails. How do I make them go away? I think you are talking about OL 2003 & the Arrange in Groups setting. Change it in View, Arrange by, uncheck Show in Groups. "silky" wrote: > Outlook mail inbox now has headers that tell you what day the the email was > sent. I find this visually annoying. Each emailalready has the time and day >...

strange date format problem
Hi, I downloaded some data on excel using Bloomberg. One column has dates and the other has numbers. Dates appear as 01/01/1980 format which I want in Jan-80 format. I have changed the format cell properties but it still appears as 01/01/1980. I have to goto individual cell and press F2 <enter> so see the effect. Dont know why? I cant even copy paste format after that .... TIA/amag I am not sure, but is your workbook set to Auto-Recalculate? Try pushing <F9> to do a manual re-calculation, see if that changes the formats. If it does, go to Tools (on the menu bar), Options, Ca...

vbs script to list files in a directory and email results
Hi. Been trying to write something with out any luck. Im looking for a script that will look in a given directory (i.e. c:\mydata) and e-mail details of what files are in that directory, the details needed are file names, date modified and size. Anyone got any sample scripts ? Thanks "systemtek" <duncan@systemtek.co.uk> wrote in message news:8c076e3d-9231-452b-8700-fd6227eb9bc8@y12g2000vbg.googlegroups.com... > Hi. > > Been trying to write something with out any luck. Im looking for a > script that will look in a given directory (i.e. c:\...

How to sort by name then date?
I would like to look through all the emails to a particular person. If I click on the "To" column I can see all the emails to a particular person (actually there is a problem with that which I will mention next) but they seem to be in random order. Is there a way to have them sorted by date? (i.e. by name first, then by date). Actually, sorting on the "To" column does not get all the emails sent to a given email address. Because Outlook uses the "display as" field. It will often give different "display as" names to the same email address. C...

Concatenate including a date so that the date appears as a date
When I try to join the contents of several cells, one of which is a date and time obtained from =now(), the date and time part appears as a number. How can I make it appear as a date and time? I have tried changing the cell formats - probably there is a combination that works but I haven't found it. I also tried copying the original date cell to another cell and changing the latter cell's format and concatenating using that latter cell, but still no success. Use the TEXT function. For example, =TEXT(NOW(),"mmmm d, yyyy") would give January 6, 2010 "dd...

Transport rule Fails with "The specific recipient is invalid Parameter namd: Address" on know good address
I found a post about using transport rules to control the direction of mail to specific address. I have found alot if information and have tried many of the solutions and all are failing on the recipient address. the address are all good address. I can send to them from inside and outside the orginization. Below is the out put from the Transport wizard. Can some one see why this rule keeps failing on me? Daryl Summary: 1 item(s). 0 succeeded, 1 failed. Elapsed time: 00:00:00 mail review Failed Error: The specified recipient is invalid. Parameter name: Address Exc...

if statement with dates #2
I would like to have a statement like: IF(a1>0,1/1/2004) with 1/1/2004 beint a date. EXCEL is interpreting 1/1/2004 as an arithmetic statement and giving me the result of the arithemtic. I could put in the numeric offste for the date and write IF(a1>0,37987), formatting the cell as a date, but this seems awkward. What else can I do? TIA, Sanford ...

zz report
Can I re-print the z and zz report? if I can't where can I find the information that I need from last month sales. Thanks -- Reynold Cycle Manager | Journal | View | Select the batch you need your Z report, hit end on your keyboard. Should take you right to the Z report for the batch you selected. You can use the same procedure from the journal in POS. Craig "Jose" <Jose@discussions.microsoft.com> wrote in message news:F326CD32-8EE9-422E-8ADC-669621818BB4@microsoft.com... > Can I re-print the z and zz report? if I can't where can I find the > information tha...

Counting Dates?
=COUNTIF(A1:A100,"<" & NOW()) This works good for specific cells. I have a similar question. How would I do the same thing given that: 1) You only have a starting date 2) Your only wanting to count work days (in this case 4 day/wk) up to NOW() Thank you for all your help. Aviator On Thu, 6 Jan 2005 12:53:03 -0800, "Aviator" <Aviator@discussions.microsoft.com> wrote: >=COUNTIF(A1:A100,"<" & NOW()) > >This works good for specific cells. I have a similar question. > >How would I do the same thing given that: >1) You only ha...

Count Unique Cells, within a date range (dates stored in separate column).
Hello All: I am attempting to create a formula that will count the number of unique cells (alpha-numeric) in an entire column (no set length, so ex: "$B:$B"). This count will be based on a date range (Between 2 dates). The dates are stored in another column (Ex: "$A:$A"). The following is an example of the cells. Dates PO_Num 1/2/2010 A123456 1/3/2010 B453453 2/2/2010 A123456 3/4/2010 C2342F3K 4/3/2010 123456 I would like to know a formula that can count the number of different PO's based on a given date range. Please help me if you...

An expression for dates from and to
I am trying to create an expression to select items from a date field falling from a certain date to a certain date. I am obviously missing something in my expression. The field name is DateComplete. How can I set up this expression to pull date from a certain date to a certain date? -- Ronnie Hi Ronnie, An example of the SQL would be: SELECT * FROM [TABLE NAME] WHERE DateComplete Between #1/1/2006# And #1/1/2007# ; On May 23, 3:52 pm, Ronnie <Ron...@discussions.microsoft.com> wrote: > I am trying to create an expression to select items from a date field falling > from a...

Returning only MAX(date) not all dates
I want to be able to list the most current date an item is checked out. As I was working through the query I used max as an aggregate function but I still can't get the simple result I want. I'd rather list the fields I have chosen and somehow select just the most current checkout date. Any help would be greatly appreciated. Here is my query: SELECT tblTerritory.TerritoryID, [TerritoryName] & " " & [TerritoryDescription] AS Description, tblTerritory.TerritoryTypeID, tblTerritoryType.TerritoryType, Max(tblTerritoryCheckout.DateCheckedOut) AS Checked...

One Range, Two Colors
I am wondering if there is a way to get Excel to loop through a series of data, build a chart based on this series of data, and alternate the colors of the bars on the chart. I guess the even points have to be a variable (i.e., Points(2).Select, Points(4).Select, etc.) This kind of a pain to do if looking at only one series. This is the macro that I recorded: Sub Macro1() ActiveSheet.ChartObjects("Chart 1").Activate ActiveChart.SeriesCollection(1).Select With Selection.Border .Weight = xlThin .LineStyle = xlAutomatic End With With Selec...

System Date
Can anyone help me on how to force the system date to a member field of "Date" type? I could not find any help on msdn that comes with visual c++. Any hint or help will be appreciated. Thanks, Behrouzk Are you just trying to get the current date. You can use CTime::GetCurrentTime() or COleDateTime::GetCurrentTime() Tom "Behrouzk" <Behrouzk@discussions.microsoft.com> wrote in message news:D8FA4B6B-73CE-4058-B50C-C9BEBAB67E68@microsoft.com... > Can anyone help me on how to force the system date to a member field of > "Date" type? I could not fi...

External Data Range Properties #2
I am using Excel 97 to get data from a Access 97 DB. When I set the "Data layout" selection box of the External Data Range Properties dialogue box to "Overwrite existing cells with new data, clear unused cells" my data range works just fine. The problem come when I save/close the worksheet and then re-open. The "Data Layout" selection box defaults to "Insert entire rows for new data, clear unused cells" and subsequence data re-fresh causes a shift in the cells below the data I am importing. Is there an option or some way I can ensure that the ...

Conditional Formatting
Hi, I have a spreadsheet that is for tracking work. I would like to have conditional formatting so that if the date in column E is between todays date and 4 weeks away then make it blue, if it is a date that is after 4 weeks away then make it yellow but if it is in the past make it red. Can this be done with conditional formatting or does it need vba? Also it would be nice if the whole row changes colour even if just the condition is on the date which is in column E - but if that can't be done then just the cell is fine. Thanks Assume the dates start in E2, select all dates w...