View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Daniel Bonallack Daniel Bonallack is offline
external usenet poster
 
Posts: 110
Default Something wrong in one line of VBA code

I copied a procedure from a Walkenbach module that pulls data from Access and
puts it into Excel - it works fine.

But I wanted to adapt it so that pulls a specific company that the user
enters. As they may not enter the exact correct name, I wanted to use the
"Like" facility.

This is the piece I copied from the final line of SQL code I took from Access
HAVING (((Master_Deal.Parent) Like "*Exxon*"));

And I adapted it to Excel VBA form with a variable:
src = src & "HAVING (((Master_Deal.Parent) Like '*" & myCompany & "*'));"

In Access I get give lines returned, in Excel, nothing. Am I correctly
using the LIKE function in Excel VBA?

Hope this is clear, and thanks for any help.

Daniel