Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with like statement in Microsoft Text Driver

Status
Not open for further replies.

harmmeijer

Programmer
Mar 1, 2001
869
CN
Here is the code I use in a vb project:
Private Sub Form_Load()
Dim rs As New ADODB.Recordset
Dim lngreccount As Long
On Error GoTo errhand
rs.Open "Select * from [mycsvname.csv] where [E-mail
Addresses] LIKE '%smtp%'", "Provider=MSDASQL.1;Persist
Security Info=False;Data Source=exportgal;Initial
Catalog=C:\Exportgal", adOpenStatic, adLockReadOnly
Do While True ' determine how many records there are
without checking eof
rs.MoveNext
lngreccount = lngreccount + 1
Loop
continuesub:
MsgBox lngreccount
Exit Sub

errhand:
If Err.Number = 3021 Then ' here the eof is true
If rs.BOF And rs.EOF Then
MsgBox "no records found"
Else
rs.MoveFirst
GoTo continuesub
End If
Else
Debug.Print Err.Number & vbCrLf & Err.Description
End If
Exit Sub
End Sub

When pressing F5 in the design mode my lngreccount is over 10000 (as it should be), but when I compile the program the lngreccount is only 1.
I notised this is caused by the like statement, if I use = or <> its all ok but not the like statement.
Tried to use * as wildcards but then I get a 0 recordcount.
The Microsoft Text driver I am using is version 4.00.4403.02.
I post this here because there may be some help comming from this forum my guess is that it has something to do asynch execution after the project has been compiled (it is a standard exe).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top