473,395 Members | 1,558 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,395 software developers and data experts.

Why do some of my records fail to find their children?

sueb
379 256MB
I have a database with 4 tables (I've attached the relationship diagram).

I have two queries that show to the user the recordset that contains Accounts and their associated 18-1 data. (The "18-1" is the name of a State of California form; that's why it's so unhelpful. It just contains information about a patient's stay in our hospital.)

The query that displays the form (pic also attached) shows all the appropriate data fields.

The query that prints all those same fields sometimes does and sometimes doesn't find the very same data that the form query does.

How can that be?

Here's the form's query:

Expand|Select|Wrap|Line Numbers
  1. SELECT [18-1].[18-1 Index], Accounts.[Account Index], Patients.[Patient Index], Patients.ChartNum, [Family Name] & ", " & [Given Name] AS Name, Patients.[Family Name], Patients.[Given Name], Patients.[Date of Birth], Accounts.Account, Accounts.Payer, Accounts.Admit, Accounts.[Emergency Admit], Accounts.[Admit ICD9s], Accounts.[Admit Diag], Accounts.[Auth Rep], [18-1].[Creation Date], [18-1].[Level of Care], Accounts.Discharge, [18-1].[Ready for Review], [18-1].[Diag ICD9s], [18-1].[Current Diag], [18-1].[Current Condition], [18-1].[Planned Procedures], [18-1].[UR Nurse], [18-1].[UR Date Signed], [18-1].[Responsible Physician], [18-1].[Dr Date Signed]
  2. FROM (Accounts INNER JOIN Patients ON Accounts.[Parent Index-Patient] = Patients.[Patient Index]) INNER JOIN [18-1] ON Accounts.[Account Index] = [18-1].[Parent Index-Account];
  3.  

Here's the report's query:

Expand|Select|Wrap|Line Numbers
  1. SELECT [18-1].[18-1 Index], [UR Nurses].[UR Nurse], [Family Name] & ", " & [Given Name] AS Name, Patients.ChartNum, [UR Demographics].Sex, [UR Demographics].[Medi-Cal Number], [18-1].[Level of Care], Patients.[Family Name], Patients.[Given Name], Patients.[Date of Birth], Accounts.Payer, Accounts.Admit, Accounts.[Emergency Admit], Accounts.[Admit ICD9s], Accounts.[Admit Diag], Accounts.[Auth Rep], Accounts.Discharge, [18-1].[Diag ICD9s], [18-1].[Current Diag], [18-1].[Current Condition], [18-1].[Planned Procedures], [18-1].[UR Date Signed], [18-1].[Responsible Physician], [18-1].[Dr Date Signed]
  2. FROM (Accounts INNER JOIN ([UR Demographics] INNER JOIN Patients ON [UR Demographics].[Parent Index-Patient] = Patients.[Patient Index]) ON Accounts.[Parent Index-Patient] = Patients.[Patient Index]) INNER JOIN ([18-1] LEFT JOIN [UR Nurses] ON [18-1].[UR Nurse] = [UR Nurses].[Nurse Index]) ON Accounts.[Account Index] = [18-1].[Parent Index-Account];
  3.  
Images:
Relations



Form

Attached Images
File Type: jpg UR relationships.jpg (54.9 KB, 250 views)
File Type: jpg 18-1 form.jpg (58.0 KB, 216 views)
May 17 '11 #1

✓ answered by sueb

Oh, never mind! (I really should change my avatar to whatever the international symbol is for "Unregenerate Idiot".)

Just as I hit the Submit button, it occurred to me that the join between the UR Demographics table and the Patients table might be a constriction, since most of the patients don't have UR demographics data entered for them.

Sure enough, once I made a query that gathered what demographics data there is to the entire Patients' table, and used that in my reports query (instead of just bare joins), everything work perfectly! (I actually also then simply used the same query for both the form and the report. duh!)

Please feel free, however, to offer any advice you have after looking at this. There is so much free-floating expertise in this group.

4 1638
sueb
379 256MB
Oh, never mind! (I really should change my avatar to whatever the international symbol is for "Unregenerate Idiot".)

Just as I hit the Submit button, it occurred to me that the join between the UR Demographics table and the Patients table might be a constriction, since most of the patients don't have UR demographics data entered for them.

Sure enough, once I made a query that gathered what demographics data there is to the entire Patients' table, and used that in my reports query (instead of just bare joins), everything work perfectly! (I actually also then simply used the same query for both the form and the report. duh!)

Please feel free, however, to offer any advice you have after looking at this. There is so much free-floating expertise in this group.
May 17 '11 #2
TheSmileyCoder
2,322 Expert Mod 2GB
Take comfort in knowing that the only difference between an expert and you is that experts have made more mistakes then you :P

I can still not write "full" code that will work in the first go, although I tend to write longer and longer codebits without errors. Extensive testing and debugging is still required, and I am getting good at that :P
May 17 '11 #3
NeoPa
32,556 Expert Mod 16PB
Hi Sue,

It's not very common for an OP to mark one of their own posts as Best Answer, but I think it would be appropriate in this case for post #2.

And nice job to smiley for updating the question to show more clearly :-)

All good.
May 17 '11 #4
sueb
379 256MB
Thanks, Smiley, for fixing my post. I forgot that I could embed pictures right in the post.

And, of course, you're right: the better you get, the more destruction you've left in your wake, and the more devastating errors you have yet to come! (somehow, that makes it all more fun) I just felt so really stupid because I had spent so very many hours on this problem without getting even a glimmer of where the real flaw lay. I'm sure, too, that getting my problem ready to present here was a big part of helping me see the light. I don't know what I'd do without this forum.

NeoPa, since you think it's appropriate, I'll go ahead and mark my answer. When I'm searching in other threads for answers, I find it disheartening when the OP has not found any of the responses to fit their needs (or, at least, they haven't said so). Actually, that's one improvement I'd like to see: when a thread has a "best answer", it would be nice if that were reflected on the sort of "home page", where all the threads are listed. Currently, each thread has some stats listed (replies, views, etc.), but it would be very helpful if it had a little star or something once it also had a best answer.

Use your influence, guys! :D
May 17 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: Anthony Baxter | last post by:
On behalf of the Python development team and the Python community, I'm happy to announce the first alpha of Python 2.4. Python 2.4a1 is an alpha release. We'd greatly appreciate it if you could...
2
by: Alex Hunsley | last post by:
I'm using a mysql monitor under cygwin (on win xp) to do a 'load data infile' to put some data into a mysql database (I'm using the xampp bundle).. My problem is that I have a four line CSV file...
3
by: Oren | last post by:
Hi, I've posted this message over at the ms-sql newsgroup – no luck. Maybe some one here could help. I have an Access application with linked tables via ODBC to MSSQL Server 2000. Having a...
1
by: Damon Grieves | last post by:
Hi Is there a way of Not allowing deletes for almost all records in a subform but allowing certain new records to be deleted? Can 'allow deletes' be flagged by a field for each record so that new...
1
by: Arjen | last post by:
Hello, I'm looking for a sample thats loads an XML file and updates some records. Can somebody give me an example in C#? Or do you have an URL where I can find the sample? Thanks!
6
by: Kevin | last post by:
On some records, the calculation is correct but on others it is wrong, why? the calculation is as follows (the source of each part of the calculation is below it): txtActualWage =\ ...
1
by: hilal84 | last post by:
Hi, I have a problem on updating some records on sql server 2005. I can update the records in the table apart from some records. Records are added to table by a .net application. When I try to...
1
by: rhector31 | last post by:
Hi, I have this file that some lines are related to the same record. I need to analize it but I need to create a flat file. I want to every time that the record start with an ENT split it and add...
3
by: ITSimTech | last post by:
I'm trying to learn how/do two things here: 1) If the user searches for "Data" ($searchtext = "Data") the output should also include the fourth record because Field1 contains "all". 2) But the...
1
by: MostBanyest | last post by:
i am not good in programming and i need help i wrote a program in VB6 that uses MS access database, its supposed to save records into a temporary database, when you are happy with the records it...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.