Sebastian Avery Simmons Sebastian Avery Simmons - 11 days ago 4
SQL Question

Searching through table description in MS Access

I am trying to search through a table and if the description contains a keyword , to have the "MIMSfield" row update.

See screenshot:

http://postimg.org/image/jivnfus5r/full/

Some direction would be awesome, not overly familiar with Access. Assuming this can be done with a VB module.

For example: If the description contains "Airlines" make the MIMSfield = A113

Answer

You dont need to use VBA. In Access go to Tab Create, button Query Design, close the window with tables that appears, swich to SQL View and write SQL command like below (use your variables) and press Run(!)

UPDATE TableName SET MIMSfield = 'WhatEver' WHERE description LIKE '*KeyWord*';

You can make the query with outer parameters like this:

UPDATE TableName SET MIMSfield = [WhatEver] WHERE description LIKE '*' + [KeyWord] + '*';

You will be prompted to provide the parameters while running the query.

Comments