Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Problems with jumping to a specific record

Posted on 1997-09-02
5
Medium Priority
?
179 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

636 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