Results 1 to 6 of 6
  1. #1
    CMXJay is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    3

    Sort a field within a field

    I'm making a query and and i have appointment dates, appointment times, and task code and i want to sort it is sorted by time in ascending order then by task code WITHIN the time in ascending.



    the way i have it now is just sorted by time in ascending order and code in ascending order and i get over 4000 results and I should only have about 6 results, it repeats every customer for every procedure for every appointment time, Not sure how i did that but I was told I could fix it be sorting the code within the time but i procrastinated from fixing it for too long and and now i have no help :/ is there something i can put in the criteria of the task code field or the appointment time field that can fix this?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    This query includes more than one table? Post the SQL statement of the query.
    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.

  3. #3
    CMXJay is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    3
    Noob Warning: I have never opened SQL before and I have no idea how this works

    SELECT [Provider Table].[Provider Name], [Appointment Table].[Appointment Date], [Patient Table].[Patient Name], [Patient Table].[Daytime Phone], [Procedure Code Table].[Procedure Code], [Procedure Code Table].[Procedure Name]
    FROM [Performed Procedures Table], [Procedure Code Table], [Insurer Table] INNER JOIN [Patient Table] ON [Insurer Table].[Insurer Code] = [Patient Table].[Insurer Code], [Appointment Table] INNER JOIN [Provider Table] ON [Appointment Table].[Provider Number] = [Provider Table].[Provider Number]
    WHERE ((([Appointment Table].[Appointment Date])=[Enter Appoitment Date]) AND (([Provider Table].[Provider Number])=[Enter Provider Number]))
    ORDER BY [Appointment Table].[Appointment Time], [Procedure Code Table].[Procedure Code];

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I see 6 tables in that query but only 4 are involved in JOIN clause.

    Should Performed Procedures Table be linked to Appointment Table?

    Should Procedure Code Table be linked to Performed Procedures Table?
    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.

  5. #5
    CMXJay is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    3
    I don't really understand the questions. I have no idea how to tell what is linked to what by the SQL

    when i open this query it is set up so it requests an appointment date and the provider number before is displays and for some reason it is displaying the correct appointment times but for every appointment time it displays every patient and it gives every procedure to every patient so there's 4000 entries and there should be less then 10 entries for every date i put in

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    View the query in Design View. If every table does not have a line to one other table then there is missing links. This creates a Cartesian relation. Every record in the unlinked tables is joined to every record in the other tables. Another possible cause of the excess records is including several tables that are the "many" side of a relationship. I don't think that is occurring here. If the relationships I describe are valid, then set up links in the query and should see reduction in record count.

    Seems you need a better understanding of relational database principles and building queries.
    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. Unable to sort field
    By Lookup in forum Access
    Replies: 5
    Last Post: 08-18-2013, 01:20 PM
  2. Group by one field, sort by another
    By tylerg11 in forum Reports
    Replies: 4
    Last Post: 03-05-2013, 01:17 PM
  3. Button to Sort by Field
    By tylerg11 in forum Programming
    Replies: 4
    Last Post: 10-20-2011, 02:43 PM
  4. Can't get one field to sort by another field
    By Sharkun in forum Reports
    Replies: 12
    Last Post: 06-01-2011, 12:42 PM
  5. Sort according to field length?
    By wawinc in forum Queries
    Replies: 4
    Last Post: 12-15-2010, 04:27 PM

Tags for this Thread

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