Results 1 to 3 of 3
  1. #1
    rd26 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    2

    Autofill field based on search

    My database has four fields: ItemName, ItemNumber, Description, and RelatedItems. I would like to create a query that will search every Description in the database and return that data in the RelatedItems field. The query should fill the RelatedItems field with a list of every ItemName and ItemNumber that contains the ItemNumber of the current record.

    Here is an example of what I would like:
    Click image for larger version. 

Name:	Untitled.png 
Views:	13 
Size:	9.5 KB 
ID:	11441



    I have no idea where to start. I would greatly appreciate your help!
    Last edited by rd26; 03-05-2013 at 01:46 PM. Reason: Edited image

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Consider this query:
    SELECT Table1_1.ItemNumber, Table1_1.ItemName, Table1_1.Description, IIf([RelDataFound]>0,[Table1].[ItemNumber] & " - " & [Table1].[ItemName],Null) AS RelData, IIf(InStr([Table1_1].[Description],[Table1].[ItemNumber])>0,1,0) AS RelDataFound
    FROM Table1, Table1 AS Table1_1
    WHERE (((Table1_1.ItemNumber)<>[Table1].[ItemNumber]));

    Then if you want to concatenate the related data into a single string, review http://allenbrowne.com/func-concat.html
    Use suggested query as the source for another query that uses Allen Browne's code to concatenate the RelData field.
    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
    rd26 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    2
    My sincerest thanks. Exactly what I needed

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

Similar Threads

  1. Autofill based on Autonumber Field?
    By W.Chan in forum Access
    Replies: 2
    Last Post: 12-06-2012, 10:51 PM
  2. Replies: 2
    Last Post: 09-13-2012, 03:42 PM
  3. Autofill field based on combo box
    By topp in forum Access
    Replies: 2
    Last Post: 06-26-2012, 04:36 PM
  4. PLEASE help: Autofill based on one field
    By Suzanne in forum Forms
    Replies: 5
    Last Post: 07-07-2011, 11:09 AM
  5. Autofill of a field based on another
    By MyWebdots in forum Forms
    Replies: 7
    Last Post: 07-12-2010, 05:00 AM

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