Solved

saving bookmark when table closes

Posted on 1998-05-19
12
175 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

895 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

16 Experts available now in Live!

Get 1:1 Help Now