Need Help with FindFirst command. 
Author Message
 Need Help with FindFirst command.

I'm posting this for a friend, please email to him at

Thanks,

Mark.

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
FindFirst method:

Can't perform operation; it is illegal.

The line that this error occurs on is the last one in the following block
of code:

Dim myDb As Database
Dim mySnap As Snapshot
Dim mySQL As String
Dim Criteria As String

Set myDb = OpenDatabase("", False, True,
"ODBC;DSN=MODS60_TEST;UID=MODS")

mySQL = "SELECT mrc, version, revdate FROM mrc WHERE mrc LIKE
'7%'"
Set mySnap = myDb.CreateSnapshot(mySQL, DATA_SQLPASSTHROUGH)

mySnap.MoveLast
txtRecCount.Text = mySnap.RecordCount Criteria = "mrc = '7AMG'"
mySnap.FindFirst Criteria

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
field name:

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.



Fri, 26 Dec 1997 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Need Help with SQL command FindFirst

2. FindFirst Help Needed

3. Problem: Using FindFirst -- Need Help

4. Need help with FindFirst

5. Findfirst method ' need help

6. Need Help w/ FindFirst....

7. NEED HELP DISABLING QB COMMANDS:IMMEDIATE REP. NEEDED

8. A simple FindFirst command ... I thought

9. question about searching database and recordset.findfirst command

10. HELP!!!!!!! I need help on MAPI commands

11. NEED HELP WITH COMMAND BUTTONS SOMEONE HELP!!!

12. Need example of using LIKE within the FINDFIRST statement

 

 
Powered by phpBB® Forum Software