Link to home
Start Free TrialLog in
Avatar of shnads
shnads

asked on

Visual Basic SQL Statement not working

Here is the statement:

dbMembers.RecordSource = "select * from Members Where Name like 'Lea%'"
dbMembers.Refresh

I have a table of Members, I want the user to be able to enter a name to search for, and all matches to be displayed on a flexgrid I have in my project bound to this database, unfortunatly while testing with the above lines of code I find it does not work, I have the database and in it under the Name field in the Members table is the name Leanne Stockwell, but the SQL above brings up a blank recordset?

I have even tried replacing 'Lea%' with '%e%' AND STILL I GET A BLANK RECORDSET???

According to every SQL and Visual Basic SQL tutorial I could find the above statement 'should' work, is there something i'm doing wrong here?

I thank you all in advance for any light you can shed on this problem !!

Please note: if I execute the code with just "select * from Members" as the recordsource I get the whole database displayed in the FlexGrid, so I KNOW I havnt done anything wrong with the data control itself.

ASKER CERTIFIED SOLUTION
Avatar of appari
appari
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of shnads
shnads

ASKER

Thankyou so much appari, I just wish that was better documented so I could have saved myself all this stress !!!

once again, thankyou :)