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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't seem to use FindFirst or NoMatch?

Status
Not open for further replies.

JennyPeters

Programmer
Oct 29, 2001
228
US
Does anyone know why I can't use the findfirst or nomatch options for my recordset? They just aren't in the list of options?

Please help!

Jenny
 
Are you searching a database? Alittle more info

or this might help
database.Recordset.FindFirst [field] = "criteria"

 
Yes, I am using a database. In the example you showed above, when you typed .Recordset. <- a list of options appeared, FindFirst being one of them. When I do this, FindFirst does not appear. If I type in findfirst, I get the error 'Method or Data Member not found&quot;

 
what is the name of your database?

type in dat infront of the name of your database then .recordset.findfirst
 
Hi,

You must know thet the FindFirst method only works with DAO and taht your recorset must be a dynaset or snapshot-type recordset.
Could you check this and if this is'nt the problem, could you post you code
 
I'm using an ADODC control that I dropped on. Does this not qualify for the above that you mentioned?

Thanks,

Jenny
 
Check the default recordset type in your connection object. JHall
 
When I look at the property pages for the ADODC control, I don't see a recordset type option any where. Were would I check for this?

Jenny
 
hi

With adodc you can't use the findfirst method
if you want to search for a record in a recordset you could use the find method

The find method searches a Recordset for the record that satisfies the specified criteria. If the criteria is met, the recordset position is set on the found record; otherwise, the position is set on the end of the recordset.

You could use something like this


Dim MyPlace as Variant
Dim myString as String
myString= InputBox(&quot;What name would you like to search for?&quot;, &quot;Find name&quot;)
With adoDc.Recordset
MyPlace= .Bookmark
.MoveFirst
.Find &quot;Name like '&quot; & myString & &quot;*'&quot;
If .EOF Then
MsgBox &quot;Name not found&quot;, vbInformation, myString & &quot; not found&quot;
.Bookmark = MyPlace
End If
End With


Note: Name is the field in the recordset
Hope this helps
Good luck
 
I see, so you can't use FindFirst with ADODC.

Thanks for you code. It was very helpful.

Where can I use findfirst then?

Jenny
 
You can use findfirst with dao code and if the recordset is of the dynaset or snapshot-type
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top