Strange problem with the LIKE operator...HELP!! 
Author Message
 Strange problem with the LIKE operator...HELP!!

Hi.

I'm using VB6, ADO and a Access 2000 DB.

When trying to do this:

rs.Open "SELECT * FROM Sourcelist WHERE Filename LIKE 'fre*' ", ConnList,
adOpenDynamic, adLockOptimistic, adCmdText

I get no records back, even though there are matching records. Doing this
directly in Access (query) gives the correct result. Have also tried to open
the Access query from VB with the same result.

It seems like the "LIKE" operator is the problem. If using = operator it
works fine. But then it's no use, beacuse I NEED the like operator.

Help please!!

David



Tue, 04 Jan 2005 17:46:02 GMT  
 Strange problem with the LIKE operator...HELP!!

Quote:

> Hi.

> I'm using VB6, ADO and a Access 2000 DB.

> When trying to do this:

> rs.Open "SELECT * FROM Sourcelist WHERE Filename LIKE 'fre*' ", ConnList,
> adOpenDynamic, adLockOptimistic, adCmdText

> I get no records back, even though there are matching records. Doing this
> directly in Access (query) gives the correct result. Have also tried to open
> the Access query from VB with the same result.

> It seems like the "LIKE" operator is the problem. If using = operator it
> works fine. But then it's no use, beacuse I NEED the like operator.

> Help please!!

> David

When using ADO you need to use % instead of * and _ instead of ? when
using wildcards, e.g.

LIKE 'fre%'

--

Tony Oakley (Microsoft Access MVP)
RF900RT



Tue, 04 Jan 2005 17:51:09 GMT  
 Strange problem with the LIKE operator...HELP!!
THANK YOU!!

You would not belive how much time I have used on that one. Back and forth,
trying different things.

But using % instead of * makes my stored query not correct in Access ? Is
there any way to make them compatible ?

But that does not matter anyway. At least for now.

Thanks,
David


Quote:

> > Hi.

> > I'm using VB6, ADO and a Access 2000 DB.

> > When trying to do this:

> > rs.Open "SELECT * FROM Sourcelist WHERE Filename LIKE 'fre*' ",
ConnList,
> > adOpenDynamic, adLockOptimistic, adCmdText

> > I get no records back, even though there are matching records. Doing
this
> > directly in Access (query) gives the correct result. Have also tried to
open
> > the Access query from VB with the same result.

> > It seems like the "LIKE" operator is the problem. If using = operator it
> > works fine. But then it's no use, beacuse I NEED the like operator.

> > Help please!!

> > David

> When using ADO you need to use % instead of * and _ instead of ? when
> using wildcards, e.g.

> LIKE 'fre%'

> --

> Tony Oakley (Microsoft Access MVP)
> RF900RT



Tue, 04 Jan 2005 18:37:11 GMT  
 Strange problem with the LIKE operator...HELP!!

Quote:

> As I know it depends on provider as well. In case if you are using JET 4.0
> you would need to use %. In case of Jet 3.51 - *

> --
> Val Mazur
> Microsoft MVP




>>>THANK YOU!!

>>>You would not belive how much time I have used on that one. Back and

> forth,

>>>trying different things.

>>>But using % instead of * makes my stored query not correct in Access ?

> Is

>>>there any way to make them compatible ?

>>>But that does not matter anyway. At least for now.

>>>Thanks,
>>>David




>>>>>Hi.

>>>>>I'm using VB6, ADO and a Access 2000 DB.

>>>>>When trying to do this:

>>>>>rs.Open "SELECT * FROM Sourcelist WHERE Filename LIKE 'fre*' ",

>>>ConnList,

>>>>>adOpenDynamic, adLockOptimistic, adCmdText

>>>>>I get no records back, even though there are matching records. Doing

>>>this

>>>>>directly in Access (query) gives the correct result. Have also tried to

>>>open

>>>>>the Access query from VB with the same result.

>>>>>It seems like the "LIKE" operator is the problem. If using = operator

> it

>>>>>works fine. But then it's no use, beacuse I NEED the like operator.

>>>>>Help please!!

>>>>>David

>>>>When using ADO you need to use % instead of * and _ instead of ? when
>>>>using wildcards, e.g.

>>>>LIKE 'fre%'

>>>>--

>>>>Tony Oakley (Microsoft Access MVP)
>>>>RF900RT

>>Only if you use DAO instead of ADO as far as I'm aware. DAO supports *
>>and ? whereas ADO supports % and _

>>--

>>Tony Oakley (Microsoft Access MVP)
>>RF900RT

Jet 3.51 still requires % and _ if accessed using ADO (using e.g. ASP).
I have several web front ends using ASP on Access 97 back end databases,
that require the aforementioned wildcards.

--

Tony Oakley (Microsoft Access MVP)
RF900RT



Tue, 04 Jan 2005 20:13:09 GMT  
 Strange problem with the LIKE operator...HELP!!
As I know it depends on provider as well. In case if you are using JET 4.0
you would need to use %. In case of Jet 3.51 - *

--
Val Mazur
Microsoft MVP


Quote:

> > THANK YOU!!

> > You would not belive how much time I have used on that one. Back and
forth,
> > trying different things.

> > But using % instead of * makes my stored query not correct in Access ?
Is
> > there any way to make them compatible ?

> > But that does not matter anyway. At least for now.

> > Thanks,
> > David




> >>>Hi.

> >>>I'm using VB6, ADO and a Access 2000 DB.

> >>>When trying to do this:

> >>>rs.Open "SELECT * FROM Sourcelist WHERE Filename LIKE 'fre*' ",

> > ConnList,

> >>>adOpenDynamic, adLockOptimistic, adCmdText

> >>>I get no records back, even though there are matching records. Doing

> > this

> >>>directly in Access (query) gives the correct result. Have also tried to

> > open

> >>>the Access query from VB with the same result.

> >>>It seems like the "LIKE" operator is the problem. If using = operator
it
> >>>works fine. But then it's no use, beacuse I NEED the like operator.

> >>>Help please!!

> >>>David

> >>When using ADO you need to use % instead of * and _ instead of ? when
> >>using wildcards, e.g.

> >>LIKE 'fre%'

> >>--

> >>Tony Oakley (Microsoft Access MVP)
> >>RF900RT

> Only if you use DAO instead of ADO as far as I'm aware. DAO supports *
> and ? whereas ADO supports % and _

> --

> Tony Oakley (Microsoft Access MVP)
> RF900RT



Tue, 04 Jan 2005 20:03:40 GMT  
 Strange problem with the LIKE operator...HELP!!
So it's impossible to make the query work in both ADO and in the Access
environment ?

David


Quote:

> > As I know it depends on provider as well. In case if you are using JET
4.0
> > you would need to use %. In case of Jet 3.51 - *

> > --
> > Val Mazur
> > Microsoft MVP




> >>>THANK YOU!!

> >>>You would not belive how much time I have used on that one. Back and

> > forth,

> >>>trying different things.

> >>>But using % instead of * makes my stored query not correct in Access ?

> > Is

> >>>there any way to make them compatible ?

> >>>But that does not matter anyway. At least for now.

> >>>Thanks,
> >>>David




> >>>>>Hi.

> >>>>>I'm using VB6, ADO and a Access 2000 DB.

> >>>>>When trying to do this:

> >>>>>rs.Open "SELECT * FROM Sourcelist WHERE Filename LIKE 'fre*' ",

> >>>ConnList,

> >>>>>adOpenDynamic, adLockOptimistic, adCmdText

> >>>>>I get no records back, even though there are matching records. Doing

> >>>this

> >>>>>directly in Access (query) gives the correct result. Have also tried
to

> >>>open

> >>>>>the Access query from VB with the same result.

> >>>>>It seems like the "LIKE" operator is the problem. If using = operator

> > it

> >>>>>works fine. But then it's no use, beacuse I NEED the like operator.

> >>>>>Help please!!

> >>>>>David

> >>>>When using ADO you need to use % instead of * and _ instead of ? when
> >>>>using wildcards, e.g.

> >>>>LIKE 'fre%'

> >>>>--

> >>>>Tony Oakley (Microsoft Access MVP)
> >>>>RF900RT

> >>Only if you use DAO instead of ADO as far as I'm aware. DAO supports *
> >>and ? whereas ADO supports % and _

> >>--

> >>Tony Oakley (Microsoft Access MVP)
> >>RF900RT

> Jet 3.51 still requires % and _ if accessed using ADO (using e.g. ASP).
> I have several web front ends using ASP on Access 97 back end databases,
> that require the aforementioned wildcards.

> --

> Tony Oakley (Microsoft Access MVP)
> RF900RT



Tue, 04 Jan 2005 20:56:11 GMT  
 Strange problem with the LIKE operator...HELP!!
I had the same dumb problem with "like". Use % instead of *. The original
wildcard was $ in DB2. Why cant they be consistent?!
Chris



Quote:
> Hi.

> I'm using VB6, ADO and a Access 2000 DB.

> When trying to do this:

> rs.Open "SELECT * FROM Sourcelist WHERE Filename LIKE 'fre*' ", ConnList,
> adOpenDynamic, adLockOptimistic, adCmdText

> I get no records back, even though there are matching records. Doing this
> directly in Access (query) gives the correct result. Have also tried to
open
> the Access query from VB with the same result.

> It seems like the "LIKE" operator is the problem. If using = operator it
> works fine. But then it's no use, beacuse I NEED the like operator.

> Help please!!

> David



Wed, 05 Jan 2005 10:23:06 GMT  
 Strange problem with the LIKE operator...HELP!!

Quote:

> So it's impossible to make the query work in both ADO and in the Access
> environment ?

> David




>>>As I know it depends on provider as well. In case if you are using JET

> 4.0

>>>you would need to use %. In case of Jet 3.51 - *

>>>--
>>>Val Mazur
>>>Microsoft MVP




>>>>>THANK YOU!!

>>>>>You would not belive how much time I have used on that one. Back and

>>>forth,

>>>>>trying different things.

>>>>>But using % instead of * makes my stored query not correct in Access ?

>>>Is

>>>>>there any way to make them compatible ?

>>>>>But that does not matter anyway. At least for now.

>>>>>Thanks,
>>>>>David




>>>>>>>Hi.

>>>>>>>I'm using VB6, ADO and a Access 2000 DB.

>>>>>>>When trying to do this:

>>>>>>>rs.Open "SELECT * FROM Sourcelist WHERE Filename LIKE 'fre*' ",

>>>>>ConnList,

>>>>>>>adOpenDynamic, adLockOptimistic, adCmdText

>>>>>>>I get no records back, even though there are matching records. Doing

>>>>>this

>>>>>>>directly in Access (query) gives the correct result. Have also tried

> to

>>>>>open

>>>>>>>the Access query from VB with the same result.

>>>>>>>It seems like the "LIKE" operator is the problem. If using = operator

>>>it

>>>>>>>works fine. But then it's no use, beacuse I NEED the like operator.

>>>>>>>Help please!!

>>>>>>>David

>>>>>>When using ADO you need to use % instead of * and _ instead of ? when
>>>>>>using wildcards, e.g.

>>>>>>LIKE 'fre%'

>>>>>>--

>>>>>>Tony Oakley (Microsoft Access MVP)
>>>>>>RF900RT

>>>>Only if you use DAO instead of ADO as far as I'm aware. DAO supports *
>>>>and ? whereas ADO supports % and _

>>>>--

>>>>Tony Oakley (Microsoft Access MVP)
>>>>RF900RT

>>Jet 3.51 still requires % and _ if accessed using ADO (using e.g. ASP).
>>I have several web front ends using ASP on Access 97 back end databases,
>>that require the aforementioned wildcards.

>>--

>>Tony Oakley (Microsoft Access MVP)
>>RF900RT

As far as I'm aware, that is the case. It may be worth posting a new
thread on this specific topic to see if anyone else knows of a
workaround you can use - unfortunately, I don't.

--

Tony Oakley (Microsoft Access MVP)
RF900RT



Fri, 07 Jan 2005 16:15:11 GMT  
 Strange problem with the LIKE operator...HELP!!
No in Access use a * in vb use a % whats the problem?

Regards

Michael



Quote:
> So it's impossible to make the query work in both ADO and in the Access
> environment ?

> David




> > > As I know it depends on provider as well. In case if you are using JET
> 4.0
> > > you would need to use %. In case of Jet 3.51 - *

> > > --
> > > Val Mazur
> > > Microsoft MVP




> > >>>THANK YOU!!

> > >>>You would not belive how much time I have used on that one. Back and

> > > forth,

> > >>>trying different things.

> > >>>But using % instead of * makes my stored query not correct in Access
?

> > > Is

> > >>>there any way to make them compatible ?

> > >>>But that does not matter anyway. At least for now.

> > >>>Thanks,
> > >>>David




> > >>>>>Hi.

> > >>>>>I'm using VB6, ADO and a Access 2000 DB.

> > >>>>>When trying to do this:

> > >>>>>rs.Open "SELECT * FROM Sourcelist WHERE Filename LIKE 'fre*' ",

> > >>>ConnList,

> > >>>>>adOpenDynamic, adLockOptimistic, adCmdText

> > >>>>>I get no records back, even though there are matching records.
Doing

> > >>>this

> > >>>>>directly in Access (query) gives the correct result. Have also
tried
> to

> > >>>open

> > >>>>>the Access query from VB with the same result.

> > >>>>>It seems like the "LIKE" operator is the problem. If using =
operator

> > > it

> > >>>>>works fine. But then it's no use, beacuse I NEED the like operator.

> > >>>>>Help please!!

> > >>>>>David

> > >>>>When using ADO you need to use % instead of * and _ instead of ?
when
> > >>>>using wildcards, e.g.

> > >>>>LIKE 'fre%'

> > >>>>--

> > >>>>Tony Oakley (Microsoft Access MVP)
> > >>>>RF900RT

> > >>Only if you use DAO instead of ADO as far as I'm aware. DAO supports *
> > >>and ? whereas ADO supports % and _

> > >>--

> > >>Tony Oakley (Microsoft Access MVP)
> > >>RF900RT

> > Jet 3.51 still requires % and _ if accessed using ADO (using e.g. ASP).
> > I have several web front ends using ASP on Access 97 back end databases,
> > that require the aforementioned wildcards.

> > --

> > Tony Oakley (Microsoft Access MVP)
> > RF900RT



Fri, 07 Jan 2005 21:58:13 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Strange problem with the LIKE operator...HELP!!

2. Strange problem with the LIKE operator...HELP!!

3. Strange problem with the LIKE operator...HELP!!

4. Help!! Strange problem Compiling database

5. Font in List box VB5 strange problem - Help needed

6. Strange problem - need Help

7. Help! Strange problem with DAO BeginTrans

8. Need help with strange extended selection list box problem

9. Strange VB build problem - HELP!

10. Strange running problem, Help!

11. HELP: strange DLL problem

12. Please help with strange VB6 related problem

 

 
Powered by phpBB® Forum Software