Yeah. I was thinking the same thing with two john smiths.
Fortunately, there hasn't yet been two people with the same name (oh thank the heavens). And I think they'll be putting a note on that in the future when they run across it..
Unfortunately, they don't wish to use an ID number for the patients at this time. The database they're having me make already has a ton of people, and although they DO have a unique ID in their system, they didn't write it in for each entry in each of the Excel Data files.
So long story short, I'd have to go in and write all their numbers. :/ I'll probably have to do it eventually though, which will take some time, but they want this table ASAP, so I dont know if they'd be willing to wait.
So.... would it be possible to use the code with First Name and Last Name in the fields?
I've done this to it....
And I have added in the table...
Name ______Date____Closing
John Smith - 1/14/14 -
John Smith - 1/18/14 -
John Smith - 1/20/14 - yes
John Smith - 2/3/14 -
John Smith - 2/7/14 -
John Smith - 2/14/14 -
John Smith - 2/15/14 - yes
John Smith - 3/12/14 -
Jane Smith - 1/14/14 -
Jane Smith - 2/24/14 -
John Carpenter - 5/1/14 - yes
What it's giving me is strange though. I'm getting this weird result where instead of it listing Jane smith with just 2 visits, it's giving me...
Name_____Number Times Visited___Closed
John Smith - 4 - yes
John Smith - 4 - yes
John Smith - 2 - no
Jane Smith - 9 - no
John Carpenter - 1 - yes
Why is it counting all the Smiths? Can I get it to recognize that a first name+last name is one entry instead of what it's doing above?...
They've also wanted me to have it look up another category on the side with this query. *head hits desk* I'm hoping that this formula with the other one I'm looking up will work together.
Fortunately, there hasn't yet been two people with the same name (oh thank the heavens). And I think they'll be putting a note on that in the future when they run across it..
Unfortunately, they don't wish to use an ID number for the patients at this time. The database they're having me make already has a ton of people, and although they DO have a unique ID in their system, they didn't write it in for each entry in each of the Excel Data files.
So long story short, I'd have to go in and write all their numbers. :/ I'll probably have to do it eventually though, which will take some time, but they want this table ASAP, so I dont know if they'd be willing to wait.
So.... would it be possible to use the code with First Name and Last Name in the fields?
I've done this to it....
Code:
SELECT [Financial Daily].[First Name], [Financial Daily].[Last Name], (SELECT COUNT(*) FROM [Financial Daily] AS T WHERE [Date Attended] between Nz((SELECT TOP 1 [Date Attended] From [Financial Daily] AS T WHERE [Date Attended]<[Financial Daily].[Date Attended] AND ([First Name]=[Financial Daily].[First Name] AND [Last Name]=[Financial Daily].[Last Name]) AND Closing=true ORDER BY [Date Attended] DESC),(SELECT Min([Date Attended]) FROM [Financial Daily] as T WHERE ([First Name]=[Financial Daily].[First Name] AND [Last Name]=[Financial Daily].[Last Name]))-1)+1 AND [Financial Daily].[Date Attended]) AS [Number Times Visited], IIf([Closing],'Yes','No') AS Closed
FROM [Financial Daily]
WHERE ((([Closing] Or [Date Attended]=(select max([Date Attended]) from [Financial Daily] as T where ([First Name]=[Financial Daily].[First Name] AND [Last Name]=[Financial Daily].[Last Name])))=True));
And I have added in the table...
Name ______Date____Closing
John Smith - 1/14/14 -
John Smith - 1/18/14 -
John Smith - 1/20/14 - yes
John Smith - 2/3/14 -
John Smith - 2/7/14 -
John Smith - 2/14/14 -
John Smith - 2/15/14 - yes
John Smith - 3/12/14 -
Jane Smith - 1/14/14 -
Jane Smith - 2/24/14 -
John Carpenter - 5/1/14 - yes
What it's giving me is strange though. I'm getting this weird result where instead of it listing Jane smith with just 2 visits, it's giving me...
Name_____Number Times Visited___Closed
John Smith - 4 - yes
John Smith - 4 - yes
John Smith - 2 - no
Jane Smith - 9 - no
John Carpenter - 1 - yes
Why is it counting all the Smiths? Can I get it to recognize that a first name+last name is one entry instead of what it's doing above?...
They've also wanted me to have it look up another category on the side with this query. *head hits desk* I'm hoping that this formula with the other one I'm looking up will work together.