Need Help with wild cards & code

DonTanner

New member
Local time
Yesterday, 17:10
Joined
Nov 24, 2012
Messages
6
Please Help!!!

I am trying to use a wild card in code but am unable to do so.... The three Access books

and online info says I can BUT....

I am using a laptop with Windows 7 and Access 2007.

I can open a file, and a Query, and an SQL statement - No problem. BUT as soon as I

add a wild card in it I can no longer open the Query or run the SQL statement.

My code is

code block/

Dim CurConn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Set CurConn = CurrentProject.Connection
Dim SqlStr As String

SqlStr = ("SELECT Description FROM tblDay WHERE Description Like 'Online Banking transfer from

CHK 2612 Confirmation# 5397372507'") '== (Works)

SqlStr = ("SELECT Description FROM tblDay WHERE Description Like 'Online*'") '== (Does not)

rst.Open SqlStr, CurConn, adOpenKeyset, adLockOptimistic, adCmdText


End Code Block/


As is with the * I do not get an error - But I niether get any results???

I am trying to pull (sort) only some items in a table. Like ALL online transfers.


I hope someone knows how I can use a wild card - Please.

:banghead:
 
With ADO try % as the wildcard. The * is used for DAO and Jet.
 
THANK YOU very much Paul. I would never have tried that and now it works. Again, thank you.:)
 
Happy to help, and welcome to the site by the way!
 

Users who are viewing this thread

Back
Top Bottom