ADODBGrid, locate and locatenext?

Hi,

I am using ADODBGrid.locate to retrieve records from an Access DB.
It is fine, but I now want to locate next record. How do I do this?


- Delphi 7 Pro
- Access 2000
- AdoDbGrid

thanks,
Christian
scholzfreeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kretzschmarCommented:
there is no locateNext,
use a filter instead of locate,
if you want to iterate through
all matching records

meikl ;-)

0
scholzfreeAuthor Commented:
Filter. How can I do this?

Thanks.
0
kretzschmarCommented:
adodataset.filter := 'SomeFieldName = SomeValue';
adodataset.filtered := true;

meikl ;-)
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

scholzfreeAuthor Commented:
Filter. How can I do this?

Thanks.
0
scholzfreeAuthor Commented:
Hi,

my code:
dbgMain.DataSource.DataSet.Filter:='Text='+edFindKey.Text;
dbgMain.DataSource.DataSet.Filtered:=True;

but I get "Exception class EOleException. Arguments wrong type".




0
kretzschmarCommented:
well you mou must quote the value for stringfields,
access accepts doublequotes as far as i know

like
dbgMain.DataSource.DataSet.Filter:='Text="'+edFindKey.Text+'"';
dbgMain.DataSource.DataSet.Filtered:=True;

hope thats it

meikl ;-)


0
kretzschmarCommented:
where comes the mou from,
in my comment above :-))
0
scholzfreeAuthor Commented:
Hi,

no sorry. same exception.

Exception class EOleException with message:
'the arguments are of the wrong type,
lie outside of the range of validity or
are incompatible with one another'.

thanks
0
kretzschmarCommented:
well, what is text for a type?
0
scholzfreeAuthor Commented:
type for "Text" is text.
0
kretzschmarCommented:
ok, have done a test,
so it works for me:

procedure TForm1.Button1Click(Sender: TObject);
begin
  if dbgrid1.DataSource.dataset.filtered then
    dbgrid1.DataSource.dataset.filtered := false
  else
  begin
    dbgrid1.DataSource.dataset.filter := 'Text = '+quotedstr(edit1.text);  //<-- single Quotes
    dbgrid1.DataSource.dataset.filtered := true;
  end;
end;

meikl ;-)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
scholzfreeAuthor Commented:
Hi,

ok, it works fine,
but I need filteroption:=[foCaseInsensitive].
Then I get the message "filteroptions are not supported". :(

thanks,
Christian
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.