Alright, I have a program querying a database to create a list of unique company names. It works fine, however, I'm adding a "filter" addition to it and so I'll be using the LIKE operator to make it work, obviously. The code works fine when using a normal query without LIKE, and otherwise returns empty, even if it -should- be able to find the records. When using the same query in Access, I returned 6 records, but in VB nothing seems to work. Can anyone see something I'm doing wrong, or something I could try to see if it would work..?

VB Code:
  1. Dim qry As ADODB.Recordset, query As String
  2.     Set qry = New ADODB.Recordset
  3.  
  4.     query = "SELECT DISTINCT companyname FROM companyrecords WHERE companyname LIKE '*a*'"
  5.     ' this query works fine: "SELECT DISTINCT companyname FROM companyrecords"
  6.  
  7.     qry.Open query, dbConn, adOpenDynamic, adLockReadOnly, adCmdText
  8.    
  9.     If qry.EOF And qry.BOF Then
  10.       MsgBox "no records"
  11.       Exit Sub
  12.     End If
  13.    
  14.     Do Until qry.EOF
  15.       MsgBox qry!CompanyName
  16.       qry.MoveNext
  17.     Loop
  18.     qry.Close
  19.     Set qry = Nothing

I'm clueless at this point, I've never worked with Access and VB before doing this project, and my experience with databases comes mostly from MySQL, but the syntax is nearly exactly the same, which is why I have no idea what's going wrong.