I'm posting this for a friend, please email to him at
I am currently using the VB Version 3.0 Professional Edition to create a
module to open a database through a custom ODBC driver, create a Snapshot
object, and use the FindFirst method to find the first occurrance of a
string within a record. However, when I attempt to execute the code within
VB, I receive the following error on the line containing the call to the
Can't perform operation; it is illegal.
The line that this error occurs on is the last one in the following block
Dim myDb As Database
Dim mySnap As Snapshot
Dim mySQL As String
Dim Criteria As String
Set myDb = OpenDatabase("", False, True,
mySQL = "SELECT mrc, version, revdate FROM mrc WHERE mrc LIKE
Set mySnap = myDb.CreateSnapshot(mySQL, DATA_SQLPASSTHROUGH)
txtRecCount.Text = mySnap.RecordCount Criteria = "mrc = '7AMG'"
txtRecCount is a text box containing the number of records retrieved from
the database. I am confused as to why this error is occurring since I
followed very closely the instructions in the VB Data Access Guide for
the Professional Edition. I am trying to perform this function without
the presence of a data control on the form. I have tried variations on
the format of the Criteria string, including putting brackets aroung the
Criteria = "[mrc] = '7AMG'"
I know for a fact that the value for the field exists in the table and
have executed this code successfully without the call to the FindFirst
method. Any advice I could get on this matter would be greatly appreciated.