?
Solved

ADODBGrid, locate and locatenext?

Posted on 2003-03-20
12
Medium Priority
?
459 Views
Last Modified: 2008-02-26
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
0
Comment
Question by:scholzfree
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
12 Comments
 
LVL 27

Expert Comment

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

meikl ;-)

0
 

Author Comment

by:scholzfree
ID: 8172377
Filter. How can I do this?

Thanks.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8172426
adodataset.filter := 'SomeFieldName = SomeValue';
adodataset.filtered := true;

meikl ;-)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:scholzfree
ID: 8172457
Filter. How can I do this?

Thanks.
0
 

Author Comment

by:scholzfree
ID: 8172533
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8172567
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8172573
where comes the mou from,
in my comment above :-))
0
 

Author Comment

by:scholzfree
ID: 8172780
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8172844
well, what is text for a type?
0
 

Author Comment

by:scholzfree
ID: 8172944
type for "Text" is text.
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 400 total points
ID: 8173106
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
 

Author Comment

by:scholzfree
ID: 8180410
Hi,

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

thanks,
Christian
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month11 days, 11 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question