Solved

saving bookmark when table closes

Posted on 1998-05-19
12
174 Views
Last Modified: 2010-08-05
How can I save a bookmark when the table closes, it seems to wipe out?  I am using TBookMarkStr with D3. Thanks, tom.
 
0
Comment
Question by:tomcorcoran
  • 5
  • 4
  • 3
12 Comments
 
LVL 1

Expert Comment

by:Greedy
ID: 1346339
What database system?
0
 

Expert Comment

by:jhunt
ID: 1346340
TBookmark is a Pointer type to a internal list witch keeps track of the record youre pointing on. When you close a table and reopen it the internal list will be createted, but at a different memory location. This wil make your saved bookmarkpointer useles.
Try this:
Make sure your table has a primary unique index and save the field value from that unique index. Next time your table opens you can perform a gotokey to go to the position you have saved.
0
 

Author Comment

by:tomcorcoran
ID: 1346341
We are using paradox. Greedy, thanks for the information, I'm not sure that this method can work as the user can select the database (and chanhe the index) at run-time. Maybe I could used the Indexdef property to find the primary index fields?

Thanks, Tom.
0
 

Expert Comment

by:jhunt
ID: 1346342
Dear Tom,
In every good table design there should be 1 unique field in eacht table, mostly of the type autoincrement. My solution suggested placing code in the beforeclose event of the ttable. From every table you should know with field is the unique key field. An as the code is executed everytime for each table it should not be that difficult to save the primary key !

John
0
 
LVL 1

Expert Comment

by:Greedy
ID: 1346343
If your useing Parodox you HAVE to have a primary key for the Table.  I'm curious why you whould want to open a table then close it then open it again?
0
 

Expert Comment

by:jhunt
ID: 1346344
Dear Tom,
if you are saving from tables with unknown structures you can iterate the indexes to find out the primary key:

to find all indexes use the GetIndexNames procedure with fills the tstrings. Then you can loop thou that list and with the
Indexproperty (TStrings.Items[loopcount], idUnique) you can find the primary index.
Finally the bde function DBIGetIndexDesc can give you the the field from the primary key.

John
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:tomcorcoran
ID: 1346345
Allright guys. JHunt, you are describing an ideal situation which I have never seen existing in a large maintained system. It's a database utlity, the user can open any one of about 100 tables, all with primary indexes from 0 to 3 fields. To satisfy your curiousity Greedy, in order to use Tutil32 to verify/repair tables the database must be closed - so I temporarily close and then reopen but don't want to loose the record the user was on. Thanks, Tom.
0
 

Author Comment

by:tomcorcoran
ID: 1346346
PS. Greedy, you do no have to have a primary key with paradox.
0
 

Author Comment

by:tomcorcoran
ID: 1346347
Greedy, FYI, you do not have to have a primary index in paradox.
0
 
LVL 1

Expert Comment

by:Greedy
ID: 1346348
Your right...I was thinking Access, sorry.  One thing you can do with Paradox is Table1.RecNo and map that to an int and then to get back to the record do this:

  Table1.DisableControls;
  Table1.First;
  For I := 1 to MyOldPos - 1 do
    Table1.Next;
  Table1.EnableControls;

You won't be able to use it for multipul users.  But it might work for what your doing.


0
 

Author Comment

by:tomcorcoran
ID: 1346349
Greedy, that worked great, thanks a million. Please post dummy answer so I can grade.  Tom.
0
 
LVL 1

Accepted Solution

by:
Greedy earned 50 total points
ID: 1346350
No problem, glad to help...
see comments for answer.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now