Re: Having problem with this query

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Norman Yuan (normanyuan_at_RemoveThis.shaw.ca)
Date: 03/26/04


Date: Fri, 26 Mar 2004 22:21:28 GMT

Are you using ADO? try to use % as wildcard, instead of *, also, use '
around text value, instead of ". That is

SQL = "SELECT * FROM [Employee Information] WHERE [Name] Like 'nav%'"

I'd use [] around field name "Name", to be safe.

"Faraz Azhar" <itz_faraz@hotmail.com> wrote in message
news:7808b5d7.0403261352.1790849@posting.google.com...
> Hello,
>
> I have a few records in an Access database. There is a field called
> "Name" in a table called "Employee Information"
>
> I have this query:
> SELECT * FROM [Employee Information] WHERE Name Like "nav*"
>
> If i use this query in Access, it works ok. It returns the complete
> details (all fields) of an employee called Naveed Ashraf. But when im
> using this in VB its not working. Im using this:
>
> SQL = "SELECT * FROM [Employee Information] WHERE Name Like ""nav*"""
> RS.Open SQL, Conn, adOpenStatic, adLockOptimistic
>
> The recordset that returns is empty, it doesnt have any records in it.
> Whats wrong with this query? why isnt recordset being populated?
>
> My code is A-OK, everything is working. Normal queries are working (
> by normal i mean : RS.Open "SELECT * FROM [Employee Information]", 3,
> 3) are working.
>
> Can anyone help?
>
> - Faraz Azhar



Relevant Pages

  • Re: Need help finishing a simple query
    ... And, in Visual Basic Script (which I believe is what FrontPage uses), ADO ... > wrote:>>>In the FrontPage discussion group I asked a question about a query and I>>received the following response:> ... It would also help to know what is in the> criterion and what is in the field you're searching, and what sort of> wildcard match you have in mind. ...
    (microsoft.public.access.queries)
  • Re: Data connection not working properly in Server Explorer
    ... Apparently I have to use %Crystal when running it through ADO ... > I have a data connection to an access database, ... > When I run this query in Access it works fine, and I get back a list ... > View" it comes back empty. ...
    (microsoft.public.dotnet.framework.windowsforms.databinding)
  • Re: How to search for apostrophes
    ... Using ADO instead of DAO it works. ... Just you must change the wildcard * by % ... in the SQL query, and only one Chr$. ...
    (microsoft.public.vb.database)
  • Re: linked tables
    ... table defined in the Access database which is linked to a SQL Server table. ... but when I try to run a query that joins the linked & ... Can somebody explain to me how this is done in ADO? ... Microsoft MVP ...
    (microsoft.public.vb.database.ado)
  • Re: running a make table query in an access database from VB
    ... Here is an example how to call the query against Access database. ... inside of the example, you will see that ADO ... but will not return the recordset. ...
    (microsoft.public.data.ado)