|
|
Hi.
I have an index in a table that is not unique. Is it possible to find all occurences using Seek? Or is Seek just used to find if a key does exist yes or no. In that case, what is the advantage of using Seek above FindFirst? Thanks in advance,
Ronald.
|
|
hi Ronald,
Ronald wrote:
[Quoted Text] > Is it possible to find all occurences using Seek? > Or is Seek just used to find if a key does exist yes or no.
I'm not sure what you really like to know.
A Seek can only find values in an index. As an index covers all records you can find all occurences of this value.
> In that case, what is the advantage of using Seek above FindFirst? Using Seek you can specify an index to use.
mfG --> stefan <--
|
|
Thanks Stefan.
But according to the Help if you use "=" or ">=" or ">" the search allways starts at the biginning of the index and "<=" or "<" starts at the end. So in my case: ..Index = "NA" '= first char of both fields ..Seek "=", "020", "1234567" Do While (.NoMatch = False) MsgBox "Found" .Seek "=", "020", "1234567" Loop
This code will loop if the key is found because the second Seek starts at the beginning of the index. So again is it possible to find any next index?
Thanks again,
Ronald.
"Stefan Hoffmann" wrote:
[Quoted Text] > hi Ronald, > > Ronald wrote: > > Is it possible to find all occurences using Seek? > > Or is Seek just used to find if a key does exist yes or no. > I'm not sure what you really like to know. > > A Seek can only find values in an index. As an index covers all records > you can find all occurences of this value. > > > In that case, what is the advantage of using Seek above FindFirst? > Using Seek you can specify an index to use. > > > > mfG > --> stefan <-- > >
|
|
hi Roland,
Ronald wrote:
[Quoted Text] > .Index = "NA" '= first char of both fields > .Seek "=", "020", "1234567" > Do While (.NoMatch = False) > MsgBox "Found" > .Seek "=", "020", "1234567" > Loop > This code will loop if the key is found because the second Seek starts at > the beginning of the index.
Can you provide a complete example? An ADODB.Recordset has neither a NoMatch nor the parameters you're using.
mfG --> stefan <--
|
|
Hi Stefan.
That code is the core part, but I use the DAO library.
Grusse,
Ronald.
"Stefan Hoffmann" wrote:
[Quoted Text] > hi Roland, > > Ronald wrote: > > .Index = "NA" '= first char of both fields > > .Seek "=", "020", "1234567" > > Do While (.NoMatch = False) > > MsgBox "Found" > > .Seek "=", "020", "1234567" > > Loop > > This code will loop if the key is found because the second Seek starts at > > the beginning of the index. > Can you provide a complete example? An ADODB.Recordset has neither a > NoMatch nor the parameters you're using. > > mfG > --> stefan <-- >
|
|
hi Roland,
Ronald wrote:
[Quoted Text] > That code is the core part, but I use the DAO library.
hmm, it's an newsgroup about ADO...
From the OH: -- If the index identifies a nonunique key field, Seek locates the first record that satisfies the criteria. --
So you can't use it to locate all matching records.
mfG --> stefan <--
|
|
Hi Stefan.
Sorry but here it says: Modules DAO VBA ADO.
But if Help says: no can do, then I will put another question in Modules Coding.
Thanks for your effort,
Ronald.
"Stefan Hoffmann" wrote:
[Quoted Text] > hi Roland, > > Ronald wrote: > > That code is the core part, but I use the DAO library. > hmm, it's an newsgroup about ADO... > > From the OH: > -- > If the index identifies a nonunique key field, Seek locates the first > record that satisfies the criteria. > -- > > So you can't use it to locate all matching records. > > mfG > --> stefan <-- >
|
|
hi Ronald,
Ronald wrote:
[Quoted Text] > Sorry but here it says: Modules DAO VBA ADO.
Don't take my advice in this case to serious, cause the name is not as precise as it code be:
microsoft.public.access.modulesdaovba.ado
> But if Help says: no can do, then I will put another question in Modules > Coding. Staying in a thread is always the better method...
mfG --> stefan <--
|
|
|