Results 1 to 7 of 7
  1. #1
    prithwisaha is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    May 2018
    Posts
    25

    populating a text box from query using group

    Need to show the data from query in a text box with grouping. Attached documents for reference. Please kindly help.

    Query Structure provided and Text box format provided.
    Attached Thumbnails Attached Thumbnails TextDate.JPG   QueryStructure.JPG  

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Requires VBA code, review http://allenbrowne.com/func-concat.html

    Example in textbox doesn't reconcile with sample records. There is no 250K7 class for 5/11/2018. Nor are the last values (8, 7, 12, 9, 55) in the records.
    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
    prithwisaha is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    May 2018
    Posts
    25
    Please check this:

    It was wrong i accept. but please provide a vba to proceed with the below screenshots:
    Attached Thumbnails Attached Thumbnails Textbox.JPG   Query.JPG  

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    The VBA is in the referenced link. You will have to adapt to your situation.

    I did a quick test. This was more difficult than usual for this sort of requirement.

    Copy/Paste the code into a VBA module.

    Query1:
    SELECT Table2.Entry_Date, [Class] & Chr(13) & Chr(10) & ConcatRelated("Batch_No & ',' & Tensile_Strength & ',' & Elongation & ',' & Brinell_HA","Table2","Entry_Date=#" & [Entry_Date] & "# AND Class='" & [Class] & "'","Entry_Date,Class",Chr(13) & Chr(10)) AS T
    FROM Table2
    GROUP BY Table2.Entry_Date, [Class] & Chr(13) & Chr(10) & ConcatRelated("Batch_No & ',' & Tensile_Strength & ',' & Elongation & ',' & Brinell_HA","Table2","Entry_Date=#" & [Entry_Date] & "# AND Class='" & [Class] & "'","",Chr(13) & Chr(10));

    Then Query2:
    SELECT Query1.Entry_Date, [Entry_Date] & Chr(13) & Chr(10) & ConcatRelated("T","Query1","Entry_Date=#" & [Entry_Date] & "#","",Chr(13) & Chr(10)) AS TT
    FROM Query1
    GROUP BY Query1.Entry_Date, [Entry_Date] & Chr(13) & Chr(10) & ConcatRelated("T","Query1","Entry_Date=#" & [Entry_Date] & "#","",Chr(13) & Chr(10));
    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
    prithwisaha is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    May 2018
    Posts
    25
    Hi

    Thanks. Please can you explain the process.

    Regards
    prithwi

  6. #6
    prithwisaha is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    May 2018
    Posts
    25
    where will i use this module??

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    You copy/paste Allen's code into a general VBA module. Then build the queries as suggested.

    What exactly do you not understand about those instructions?
    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. Query Populating Primary key instead of text
    By Pfunk11 in forum Queries
    Replies: 9
    Last Post: 06-29-2017, 06:18 PM
  2. Replies: 1
    Last Post: 08-04-2014, 07:37 AM
  3. Option Group Not Populating
    By Lowell in forum Forms
    Replies: 8
    Last Post: 04-09-2013, 09:51 PM
  4. query column not populating text box.
    By mejia.j88 in forum Queries
    Replies: 2
    Last Post: 02-23-2012, 02:48 PM
  5. Replies: 17
    Last Post: 08-19-2011, 01:19 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