Results 1 to 6 of 6
  1. #1
    epardo87 is offline Competent Performer
    Windows 7 32bit Access 2016
    Join Date
    Dec 2016
    Posts
    101

    report pulling ID instead of description

    Hello All,

    I've created some queries and at the end a report, it groups the results first per Name and then by per Day. the problem is that I have a table for names and another for days,

    when I create the queries, they show the text correctly, but now that I've created the report, it shows the ID number of the name and the ID number of the Day... even when the query used to create that report shows the text... how could I make the report show the text instead of the ID numbers?



    thanks for your time

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Sounds like you've used a lookup field, which most of us won't:

    http://www.theaccessweb.com/lookupfields.htm

    You can base the report on a query that joins the tables together, enabling you to return the text field.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    epardo87 is offline Competent Performer
    Windows 7 32bit Access 2016
    Join Date
    Dec 2016
    Posts
    101
    Quote Originally Posted by pbaldy View Post
    Sounds like you've used a lookup field, which most of us won't:

    http://www.theaccessweb.com/lookupfields.htm

    You can base the report on a query that joins the tables together, enabling you to return the text field.
    thanks! yeah i know about it... I tried that, but when I link the original table with the final query either it doesn't return anything or it says Type Mismatch in expression

    this is the SQL as it is right now:
    Code:
    SELECT [Qry-NutrPerDay-Detail].Paciente, [Qry-NutrPerDay-Detail].Día, [Qry-NutrPerDay-Detail].Nutr_No, [Qry-NutrPerDay-Detail].NutrDesc, Sum([Qry-NutrPerDay-Detail].[N utr_PP]) AS [SumOfN utr_PP], [Qry-NutrPerDay-Detail].UnitsFROM [Qry-NutrPerDay-Detail]
    GROUP BY [Qry-NutrPerDay-Detail].Paciente, [Qry-NutrPerDay-Detail].Día, [Qry-NutrPerDay-Detail].Nutr_No, [Qry-NutrPerDay-Detail].NutrDesc, [Qry-NutrPerDay-Detail].Units;
    when I try to link them and reads mismatch, this is the SQL:
    Code:
    SELECT [Qry-NutrPerDay-Detail].Paciente, [Qry-NutrPerDay-Detail].Día, [Qry-NutrPerDay-Detail].Nutr_No, [Qry-NutrPerDay-Detail].NutrDesc, Sum([Qry-NutrPerDay-Detail].[N utr_PP]) AS [SumOfN utr_PP], [Qry-NutrPerDay-Detail].Units, [tbl-Names].NombreFROM [Qry-NutrPerDay-Detail] INNER JOIN [tbl-Names] ON [Qry-NutrPerDay-Detail].Paciente = [tbl-Names].ID
    GROUP BY [Qry-NutrPerDay-Detail].Paciente, [Qry-NutrPerDay-Detail].Día, [Qry-NutrPerDay-Detail].Nutr_No, [Qry-NutrPerDay-Detail].NutrDesc, [Qry-NutrPerDay-Detail].Units, [tbl-Names].Nombre;

  4. #4
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    I'm only guessing, but the error may be here:

    [Qry-NutrPerDay-Detail].Paciente = [tbl-Names].ID

    Both Paciente and ID have to be the same type. ID probably is numeric, but is Paciente also numeric?


  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Here is the SQL reformatted for readability

    Code:
    SELECT [Qry-NutrPerDay-Detail].Paciente
    	,[Qry-NutrPerDay-Detail].Día
    	,[Qry-NutrPerDay-Detail].Nutr_No
    	,[Qry-NutrPerDay-Detail].NutrDesc
    	,Sum([Qry-NutrPerDay-Detail].[N utr_PP]) AS [SumOfN utr_PP]
    	,[Qry-NutrPerDay-Detail].Units
    	,[tbl-Names].NombreFROM [Qry-NutrPerDay-Detail]
    INNER JOIN [tbl-Names] ON [Qry-NutrPerDay-Detail].Paciente = [tbl-Names].ID
    GROUP BY [Qry-NutrPerDay-Detail].Paciente
    	,[Qry-NutrPerDay-Detail].Día
    	,[Qry-NutrPerDay-Detail].Nutr_No
    	,[Qry-NutrPerDay-Detail].NutrDesc
    	,[Qry-NutrPerDay-Detail].Units
    	,[tbl-Names].Nombre;

  6. #6
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    @epardo87:
    "Day" ("Dia") is a reserved word (and a built in function) in Access and shouldn't be used as an object name.
    "Name" ("Nombre") is a reserved word in Access and shouldn't be used as an object name.


    Suggestions:
    Use only letters and numbers (exception is the underscore) for object names. (Use the underscore instead if the dash)
    Do not use spaces, punctuation or special characters in object names.
    Do not use look up FIELDS, multi-value fields or calculated fields in tables.

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

Similar Threads

  1. Report not pulling in all data
    By bennyamy in forum Access
    Replies: 6
    Last Post: 03-06-2017, 10:30 AM
  2. Report not pulling correct record
    By jlo33jenn in forum Reports
    Replies: 6
    Last Post: 06-25-2015, 09:14 AM
  3. Replies: 5
    Last Post: 06-11-2015, 06:45 PM
  4. Pulling only one record into a report
    By jessicamosby in forum Access
    Replies: 9
    Last Post: 07-17-2014, 08:08 AM
  5. Textual Description in Report
    By smarty84handsome in forum Reports
    Replies: 3
    Last Post: 01-19-2012, 01:08 AM

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