?
Solved

Problems with jumping to a specific record

Posted on 1997-09-02
5
Medium Priority
?
178 Views
Last Modified: 2012-05-04
Hi!!
I have some problems finding a procedure with wich you can jump to a specific record-number in a table, like this:

DM1.Table1.XXXX[5];
(Where I want to jump to record number five..)

I looked at GotoKey, Find and the rest of them, however they all need information other than just the record-number.

I use Delphi Developer 2.0 and the table is a Paradox-base.

Thanx!
Erik N
0
Comment
Question by:Erik N
[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
  • 2
  • 2
5 Comments
 
LVL 3

Expert Comment

by:mirek071497
ID: 1343400
What you mean with Jump ?
You need read data of this record, delete or any other ?
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 30 total points
ID: 1343401
Hi Erik N,

There exists a procedure MoveBy(Distance: integer) :

The MoveBy method moves the dataset cursor by Distance records. If Distance is negative, the move is backward. If Distance is positive, the movement is forward. If Distance is zero, no move is done. MoveBy returns the number of records that were traversed.

You can use this procedure to go to the fifth record in a table.
Do it like this :

DM1.Table1.First; { Go to the first record }
DM1.Table1.MoveBy(+5); { Go to the fifth record }

So, make a function :

function MoveTo(RecordPos: Integer):Integer;
begin
 with DM1.Table1 do begin
  First;
  Result := MoveBy(RecordPos);
 end;
end;

If you need it to work on different tables :

function MoveTo(OnTable:TTable;RecordPos:integer):integer;
begin
 with OnTable do begin
  First;
  Result := MoveBy(RecordPos);
 end;
end;
 
OffCourse you better improve these functions with error checking!

Have fun,
c.u. ZifNab;

Questions, just ask!
0
 

Author Comment

by:Erik N
ID: 1343402
Thank you ZifNab, for your excellent answer!
I really appreciate it..
Erik N
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1343403
Glad I could help you,

Does it works like you wanted it?
Sad that you always have to go to the first record isn't it?

Have fun,
c.u. ZifNab;
0
 

Author Comment

by:Erik N
ID: 1343404
I agree ! It´s sad, but it doesn´t really matter..
I will give you the Points for this later on...
Erik N
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
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 Month13 days, 11 hours left to enroll

801 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