Results 1 to 4 of 4
  1. #1
    cherold is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2014
    Posts
    82

    How do I set a field based on search results?

    I have a database listing all my old, physical-media music. At the time I created it, instead of creating a media-type field, I just used the comments field to indicate if it was something other than vinyl. Now I've created a media-type field and I'd like to find an easy way to populate it. If the comments field contains "(T-" then it's a reel-to-reel tape (ID 4). "(c)" makes it a casette (ID 3). CD, of course, means it's a CD (ID 2). And if it's none of those, then it's vinyl (ID 1).



    This isn't an ongoing issue, I just need something to set the media-types in one fell swoop and then in future I'll just set it manually for anything I add. Is there a way to do this via macro?

  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
    Not a macro, an update query. Since it's a one-time thing, I'd just run a query several times with a different criteria and a different value. For example:

    UPDATE TableName
    SET NewFieldName = 4
    WHERE OldFieldname Like "T-*"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    cherold is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2014
    Posts
    82
    Beautiful, thanks!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 3
    Last Post: 09-02-2013, 04:33 PM
  2. Replies: 12
    Last Post: 08-17-2013, 11:49 PM
  3. Field selection based on quey results
    By Xarkath in forum Access
    Replies: 1
    Last Post: 06-14-2013, 04:37 PM
  4. Replies: 3
    Last Post: 01-24-2013, 08:16 PM
  5. Return results based on a partial search
    By TimMoffy in forum Queries
    Replies: 2
    Last Post: 07-27-2012, 11:09 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