Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 run a find on a SQL recordset in VB using LIKE '%01'

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-07-02 : 08:16:13
Morgan writes "I am trying to run a Find on a ADO recordset using
an SQL syntax for the Find.
I need to run for a WildCard Character.
here is my code.
----------------------------------------------------------------

Dim adoQuoteRS As Recordset
'create a recordset to search on
Dim strsql As String
Set adoQuoteRS = New Recordset
strsql = "SELECT tblQuotes.*, tblQuoteLog.*, tblProjects.* " & _
"FROM tblProjects " & _
"INNER JOIN tblQuotes ON tblProjects.ProjectsID = tblQuotes.ProjectID " & _
"INNER JOIN tblQuoteLog ON tblQuotes.QuoteID = tblQuoteLog.QuoteID"

adoQuoteRS.Open strsql, g_objConn, adOpenStatic

If FindLookIn = "QuotationNo" Then
'If FindLookIn = "Entire Database" Then
With adoQuoteRS
.MoveFirst
'.Find (FindLookIn & "= '" & findvalue & "'")
.Find ("QuotationNo = '%10881'")
'WHERE (QuotationNo LIKE '%10881')
If .BOF Then
MsgBox "Matching Record not Found"
End If
End With
End If

adoQuoteRS.Close
---------------------------------------------------------------

I cannot get VB to accept the LIKE as valid If I just look for the
entire value then I can find it with out using a wildcard character.
any help would be appreciated."
   

- Advertisement -