wild card error "*" in sql script

hawkpig

Registered User.
Local time
Today, 01:53
Joined
Jun 5, 2007
Messages
10
Hi chaps

I am a little stumped here. I have created a simple SELECT sql script which works fine if I make the "WHERE" part of the query refer to a specific record, but if I use a wildcard, the process errors saying that no records are found even though I know there are records that meet the criteria.

Does anyone have any ideas or thoughts?

********************************

I am using access 2003 - the VBA editor is version 6.3

********************************
this works:

Dim MySql As String

MySql = MySql & " SELECT [CURRENT POLICY #]"
MySql = MySql & " FROM [C01 RENEWAL TABLE]"
MySql = MySql & " WHERE ([CURRENT POLICY #] LIKE 'COM002000')"
MySql = MySql & " order by [CURRENT POLICY #]"



********************************
this doesn't:

Dim MySql As String

MySql = MySql & " SELECT [CURRENT POLICY #]"
MySql = MySql & " FROM [C01 RENEWAL TABLE]"
MySql = MySql & " WHERE ([CURRENT POLICY #] LIKE 'COM*')"
MySql = MySql & " order by [CURRENT POLICY #]"
 
Last edited:
perhaps its not using the widcard properly

maybe its actually looking for a record called COM*

--------
try preparing a visual query, and see if the sql looks like what you had
 
What are you doing with the SQL string? If you're opening an ADO recordset, it wants % as the wildcard instead of *.
 
Hi Paul

That did the trick - you're a legend - thanks for your help

I'll ignore all the rude things people say about you on this forum - just kidding.

thanks again.
 
Happy to help...and I ignore them too. :D
 

Users who are viewing this thread

Back
Top Bottom