Skip to content
Advertisement

Access VBA Find Records using Search Critera in Recordset

I have an Access database connected to excel. I need to find records using Search criteria in recordset from Excel

  1. Table name in MS Access is MyTable with more than 10 columns with data
  2. User enters string data in Excel cell, let us assume Worksheets("Sheet1").Cells(1, 1)
  3. My need is, macro has to loop through any matching string in column7 and column 10 and copy corresponding recordset in three columns (column1, column7 and column 10) into Worksheets(“ALL”).Cells(3, 1)…Cells(3,3), etc

  4. Data in column7 and column 10 will have more than 500 character text in one record cell. Search string may present in more than one record cell; hence output will be found in more than one recordset.

Do we have any other option with instr function along with a SQL query?

Any help would be much appreciated. My thanks in advance.

Advertisement

Answer

This should work. Remember to enter the path to your access file.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement