Results 1 to 7 of 7
  1. #1
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338

    All data not showing

    Hi-

    I put a union query together but for some reason it only show some of the data. For the ones in bold it's not showing the CPT1New code. Attached is a copy of the db.NEWdb.zip


    PtAcct DateofService AdjAmt1 CPT1new
    4454Doe 28-Jan-14 50 99214
    4454Doe 14-Feb-14 50
    4454Doe 14-Feb-14 1.94 99214
    5164Ray 06-May-14 1.1
    5164Ray 06-May-14 75 20610
    5164Ray 06-May-14 50 99213
    5164Ray 06-May-14 44.5 J1030
    5164Ray 19-May-14 0.55
    5164Ray 19-May-14 50 20610
    5164Ray 19-May-14 50 99213
    5164Ray 19-May-14 22.25 J1030


  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Perhaps you need to use UNION ALL
    http://www.w3schools.com/sql/sql_union.asp

  3. #3
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085
    First thing I would do is add a column to each Select in the union that shows which select is returning those rows.

    Select ...,1 as querynumber
    Union
    Select ...,2
    Union
    Select ...,3

    That will tell you where it's happening then you can check that particular query to determine why.

  4. #4
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    I try using Union All and it didn't work.

    Thank you


    Quote Originally Posted by ItsMe View Post
    Perhaps you need to use UNION ALL
    http://www.w3schools.com/sql/sql_union.asp

  5. #5
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You need to look at the union query - the column heading is not the field that is being displayed. For instance, the 4th line above comes from the 4th part of the union, which is Amt4 (1.1) and CPT4 (blank).

  6. #6
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    Aytee

    You are right there is no data amt4. So it would not show it.
    I'm going about this the wrong way.
    How would i be able to correct this?
    The data is horizontal and i would like it to show vertical. Each patient can have up to 10 amt for each date of service.



    Quote Originally Posted by aytee111 View Post
    You need to look at the union query - the column heading is not the field that is being displayed. For instance, the 4th line above comes from the 4th part of the union, which is Amt4 (1.1) and CPT4 (blank).

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Simplify - build the UNION from the table, not the query, with or without filter criteria. Can do the Replace calcs in the UNION to adjust the data for CPT. Then use the UNION as source for subsequent queries. The semi-colon goes on only the last line.

    Forum is not letting me type UNION in the sql example. Replace the underscores.

    SELECT 1 AS Source, PtID AS PtAcct, DateofService, CPT1 AS CPT, AdmAmt1 AS AdjAmt FROM TabNewDataClimacs
    ______ SELECT 2 AS Source, PtID, DateofService, CPT2, AdmAmt2 FROM TabNewDataClimacs
    ______ SELECT 3, PtID, DateofService, CPT3, AdmAmt3 FROM TabNewDataClimacs
    ______ SELECT 4, PtID, DateofService, CPT4, AdmAmt4 FROM TabNewDataClimacs;

    A UNION basically manipulates data into normalized structure should be to start with. An issue could be that each record does not have a unique identifier.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 15
    Last Post: 04-16-2014, 01:15 PM
  2. Replies: 4
    Last Post: 02-27-2012, 10:29 AM
  3. Data is not showing up in the form
    By zuerin in forum Access
    Replies: 1
    Last Post: 07-13-2011, 09:16 AM
  4. Showing data from different queries
    By samefilip in forum Reports
    Replies: 7
    Last Post: 01-06-2011, 11:09 AM
  5. Data Not Showing in Reports
    By Delin in forum Reports
    Replies: 1
    Last Post: 01-26-2006, 08:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums