Merging multiple records into 1 record

L

LisaK

I'm going to try and explain this as best as I can. I have the following
records as an example:

PatientID Program RecInsDt
12345678 Heart 4/26/2009
12345678 Diabetes 7/26/2009

What I want to do is make a table and have each patient listed only once but
add fields that say "Program1" and "Program2" and have Heart and Diabetes
listed on the one record in separate fields.

Any suggestions? I hope that makes sense.

Thanks
 
A

Arvin Meyer [MVP]

And what happens if you get a patient with liver ailment, or lung disorder?
If you have a column for every possibility, you'll run out of columns. Your
design is correct. Leave it that way. If you need to, you can display the
data in a report, like:

PatientID Program RecInsDt
12345678 Heart 4/26/2009
Diabetes 7/26/2009
 
L

LisaK

I'm only taking the Top 3 so I am only going to have Program1, Program2 and
Program 3.
 
B

BruceM

You have been told many times that solicitation in this newsgroup is
inappropriate. You know that more will follow, including links to
information your dubious business practices and other details.

Recently you claimed to have a successful business providing Access Help,
yet you continue to grovel here. If you succeed in collecting any money
from your trolling it is because somebody has decided your unsubstantiated
claims are worth more than the substantiated warnings about you.
 
C

CraigH

Lisa,

Arvin is correct don't change to the Program1 to 3. Becasue you would
have to do it for RecInsDt and any other fields in this table. 3*(how many
fields). This is not simply a preferred way of doing things. Your way goes
against all relational database design standards.

If you need to "see" it that way then you can use a Crosstab Query and
other methods to show the information in that format.

Please you have come to the light don't go back to the Spreadsheet :)
 
J

John... Visio MVP

Steve said:
You DON'T want to make a table and have the same data recorded twice in
your database. Keep the table you have (it is correct) and create a
crosstab query then base a form on the crosstab query. For a report,
create a two column report.

If you need help with your database, I can help you. I provide help with
Access, Excel and Word applications for a nominal fee. Contact me if you
would like my help.

Steve
(e-mail address removed)

These newsgroups are provided by Microsoft for FREE peer to peer support.
There are many highly qualified individuals who gladly help for free. Stevie
is not one of them, but he is the only one who just does not get the idea of
"FREE" support. He offers questionable results at unreasonable prices. If he
was any good, the "thousands" of people he claims to have helped would be
flooding him with work, but there appears to be a continuous drought and he
needs to constantly grovel for work.

A few gems gleaned from the Word New User newsgroup over the Christmas
holidays to show Stevie's "expertise" in Word.


Dec 17, 2008 7:47 pm

Word 2007 ..........
In older versions of Word you could highlght some text then go to Format -
Change Case and change the case of the hoghloghted text. Is this still
available in Word 2007? Where?
Thanks! Steve


Dec 22, 2008 8:22 pm

I am designing a series of paystubs for a client. I start in landscape and
draw a table then add columns and rows to setup labels and their
corresponding value. This all works fine. After a landscape version is
completed, I next need to design a portrait version. Rather than strating
from scratch, I'd like to be able to cut and paste from the landscape
version and design the portrait version.
Steve


Dec 24, 2008, 1:12 PM

How do you protect the document for filling in forms?
Steve


One of my favourites:
Dec 30, 2008 8:07 PM - a reply to stevie
(The original poster asked how to sort a list and stevie offered to create
the OP an Access database)
Yes, you are right but a database is the correct tool to use not a
spreadsheet.


Not at all. If it's just a simple list then a spreadsheet is perfectly
adequate...




John... Visio MVP
 
A

Arvin Meyer [MVP]

Given that this relates to health care, taking the top 3 only, may result in
the untimely demise of a patient. Unless you are the Surgeon General, you
probably, don't have control anyway, so next year when your boss sees that
the top 3 is insufficient, and decides to add 2 more, you have a big
problem. Ever patient must now be re-examined to determine if there are more
than 3.

Besides, your proposed design is incorrect, even if you never have more than
3. If you are going to do this, do it right. Actually, your first attempt
was right. Be proud of that. Too many people do it wrong and suffer the
design problems in the future.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
J

John Spencer

Two query solution'

First Query saved as qRankDx

SELECT A.PatientID, A.Program, A.RecInsDt
, 1+Count(B.RecInsDt) as RankDX
FROM tblDX as A LEFT JOIN tblDx as B
On A.PatientID = B.PatientID
AND A.RecInsDt < B.RecInsDt
GROUP BY A.PatientID, A.Program, A.RecInsDT
HAVING Count(B.RecInsDt) < 3

You might have to change the < operator with a > operator in the join.
I screw that up about 50 percent of the time. One gives you the most
recent and the other gives you the oldest.

Second query uses the first saved query in a crosstab query

TRANSFORM First(Program) as fProgram
SELECT PatientID
FROM qRankDX
GROUP BY PatientID
PIVOT RankDX



'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

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