Hi,
I'm trying to populate a flexgrid in my VB 6.0 application with values from a query of an Access table:
sql = sql & "SELECT * "
sql = sql & "FROM SongInfo "
sql = sql & "WHERE " & Sec1 & Sec2 & Sec3
'Populate flexgrid
Set db = OpenDatabase(Appl)
Set qu = db.CreateQueryDef("", sql)
Set rs1 = qu.OpenRecordset
Sec1, Sec2 and Sec3 are strings that the user creates by populating fields on the search form. In this example, there's nothing in Sec2 or Sec3, so, sql ends up looking like this:
SELECT * FROM SongInfo WHERE SongTitle Like '*amazing*'
The problem is I'm only getting 1 record. If I run the EXACT SAME QUERY in MS Access, I get multiple records, so it's working fine there. I've tried all the different options (dbOpenDynaSet, dbOpenTable, etc.) without any success. I know the flexgrid is working OK, because I've checked the recordcount before getting to the flexgrid code. Any ideas?
VB 6.0
MS Access 2003
I'm trying to populate a flexgrid in my VB 6.0 application with values from a query of an Access table:
sql = sql & "SELECT * "
sql = sql & "FROM SongInfo "
sql = sql & "WHERE " & Sec1 & Sec2 & Sec3
'Populate flexgrid
Set db = OpenDatabase(Appl)
Set qu = db.CreateQueryDef("", sql)
Set rs1 = qu.OpenRecordset
Sec1, Sec2 and Sec3 are strings that the user creates by populating fields on the search form. In this example, there's nothing in Sec2 or Sec3, so, sql ends up looking like this:
SELECT * FROM SongInfo WHERE SongTitle Like '*amazing*'
The problem is I'm only getting 1 record. If I run the EXACT SAME QUERY in MS Access, I get multiple records, so it's working fine there. I've tried all the different options (dbOpenDynaSet, dbOpenTable, etc.) without any success. I know the flexgrid is working OK, because I've checked the recordcount before getting to the flexgrid code. Any ideas?
VB 6.0
MS Access 2003