>I would like to know, between 'Seek on a table object' and 'FindFirst on
>a dynaset' methods which is faster?
>I have an application in VB where I need to find a specific record in a Access
>table in a database. I am right now using a FindFirst method on a dynaset,
>which is painfully slow!!
>Secondly since the table is involved in a complex relationship (it is both on
>the many side as well as the one side), I am not sure how to use the keys in a
>seek method. All my experiments with different keys failed.
>Thanks in advance for all yr help
The .Seek Method is much faster but also more limited.
It can only 'Seek' a value from a Table (not a Dynaset)
and you can only seek in an indexed field.
search MyIndexedField for SearchValue
tblMyTable.Index = "MyIndexedField"
tblMyTable.Seek "=", "SearchValue"
If the Index field you chose is not Unique you will
have to walk thru the table to get the proper record.
Do While tblMyTable("MyIndexedField") = "SearchValue"
If tblMyTable("AnotherField") = "AnotherValue"
You can not use the .Seek method on a 'complex relationship'
unless you create a new temp Table to hold the values returned
by your query. You will need to have the Table in your database
already or build the Table in code. You will probably want to
delete all the records before re-populating the Table w/ new
values. I think you should be able to use a 'SELECT INTO' query
(Search the help 'SELECT INTO') to populate the table but I'm
not sure about this. Otherwise you will have to populate the
Table in code.
The overhead of creating a new temp Table will probably not
be worth while unless you are going to do a lot of searching
of the result set. You will need to run some test to find the
most effient method for your app.
/ / \\\\\\\\\\\\\\\\\\\/////////////////////
/ ___/__ Scott Kostakos
/__/__/ Only Solutions
/ There are no problems, only solutions