Error in using FIND method in ADO recordset

Y

Yanto

I tried to use Find in ADO recordset (MSDE) as follows:

rst.Find "(([UserID]=" & pubUserID & ") And ([FormReportID]=" &
DLookup("[FormReportID]", "tblFormReports", "[FormReportName]='" & Me.name &
"'") & "))"

this code result an error like this:

"The application is using arguments that are of the wrong type, are out of
acceptable range, or are in conflict with one another"

If I remove the part folows the word "And", no error produced, it seems that
I can't use "And" in criteria.
Any comment please? anything wrong with that code?
TIA

Rgds

Yanto
 
M

Michel Walsh

Hi,

You can't have a complex clause with the ADO FIND method. Indeed, opening a
(large) recordset to spot one of its record is generally not the most
multi-user friendly design. Try to open just the part of the recordset you
need, at the beginning, or use a Filter (which accept multiple clause with
AND/OR conjunctions). If all that fail, open a recordset with the WHERE
clause already in place:

Dim uvw As ADO.Recordset
Set uvw=CurrentProject.Connection.Execute("SELECT ... WHERE UserID=" &
.... )


rather than using Find, and inspect that new recordset (rather than the old
one).


Hoping it may help,
Vanderghast, Access MVP
 
Y

Yanto

Thanks a lot, Michael
Rgds

Yanto

Michel Walsh said:
Hi,

You can't have a complex clause with the ADO FIND method. Indeed, opening a
(large) recordset to spot one of its record is generally not the most
multi-user friendly design. Try to open just the part of the recordset you
need, at the beginning, or use a Filter (which accept multiple clause with
AND/OR conjunctions). If all that fail, open a recordset with the WHERE
clause already in place:

Dim uvw As ADO.Recordset
Set uvw=CurrentProject.Connection.Execute("SELECT ... WHERE UserID=" &
... )


rather than using Find, and inspect that new recordset (rather than the old
one).


Hoping it may help,
Vanderghast, Access MVP


Yanto said:
I tried to use Find in ADO recordset (MSDE) as follows:

rst.Find "(([UserID]=" & pubUserID & ") And ([FormReportID]=" &
DLookup("[FormReportID]", "tblFormReports", "[FormReportName]='" &
Me.name
&
"'") & "))"

this code result an error like this:

"The application is using arguments that are of the wrong type, are out of
acceptable range, or are in conflict with one another"

If I remove the part folows the word "And", no error produced, it seems that
I can't use "And" in criteria.
Any comment please? anything wrong with that code?
TIA

Rgds

Yanto
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top