Hi,

I was wondering if anyone could tell me what i'd done wrong. The following is the code. What it does is to check if the data user input is valid before it goes print preview the report for that particular record. My problem is to ensure that it detects the input like a*. then it should go and find out anyrecords started with "a" letter just like wild card "like"

Dim cnnNew As New ADODB.Connection
Dim rsNew As New ADODB.Recordset
Dim queryString, SystemName As String
Dim isrecordfound As Boolean

isrecordfound = False

SystemName = Chr$(34) + Me.CB_System + Chr$(34)

queryString = "SELECT [System].System_Name FROM [System] WHERE [System].System_Name = like " & SystemName

rsNew.Open queryString, CurrentProject.Connection, adOpenDynamic, adLockOptimistic

Do Until rsNew.EOF
isrecordfound = True

rsNew.MoveNext
Loop

rsNew.Close

From the code above, i've got syntax error.

Can anyone give me advice on how to fix this error?

Many thanks