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

Find command error

Status
Not open for further replies.

bugzLue

IS-IT--Management
Feb 27, 2001
57
US
I get a error with the code below the part [ .Index ] this what is shown to me when I debug. the column that I am trying to do the search on is called Code.


Compile error:
Method or data member not found

Private Sub cmdFind_Click()
prompt$ = "Enter the full Code for all sibling search."
'get string to be used in the Code field search
SearchStr$ = InputBox(prompt$, "Sibling Search")
datPrimaryRS.Recordset.Index = "Code" 'use Code
datPrimaryRS.Recordset.Seek "=", SearchStr$ 'and search
If datPrimaryRS.Recordset.NoMatch Then 'if no match
datPrimaryRS.Recordset.MoveFirst 'go to first record
End If
End Sub

thks
Greg Live to learn or die trying
 
Is the recordset ADO or DAO?

If it is ADO there is no property or method called 'NoMatch'. So that might be causing your error. Thanks and Good Luck!

zemp
 
It is ADO, can you direct me to a book or somewhere I can find out how to do the samething with ADO. I tryed to comment out the line with NoMatch but still get the error


Compile error:
Method or data member not found


Thks Live to learn or die trying
 
Look through the FAQ section of this forum, it holds some very usefull information. So does MSDN.

Another method to consider is to do your search via the SQL statement. Right now you might be pulling all records from a table into VB and then searching the recordset for your value. Try instead to incorporate the search criteria into your SQL Statement that defines your recordset. This way the recordset contains the data you want and does not pull over as many records. Fewer records means less network traffic and a faster response time. Let the database do the work. Your SQL Statement will then look like this.

&quot;Select * From <Table> Where <Field> ='&quot; & <Variable> & &quot;'&quot;

You can also go to some of the online 'schools' or tutorials, such as W3Schools. You can find that link in the partners section of this page.

I am sorry that I can't be more help with the seelk method of the recordset. I don't do it that way. I usually pass parameters to stored procedures and let the database do most of the sorting and finding. Thanks and Good Luck!

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top