diver999
asked on
Function of DBNavigator buttons
I am using DBNavigator to update a DBGrid
The insert button will create a new record before the current record.
I need to create the new record at the end, so using Append
How do you modify the actions of the DBNavigator buttons ?
Thanks
Richard
The insert button will create a new record before the current record.
I need to create the new record at the end, so using Append
How do you modify the actions of the DBNavigator buttons ?
Thanks
Richard
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks - I'll take a look at that
They are linked to a table and I using Paradox 7.
One other thing - this is a detail file I have a secondary index in the record to display only certain records. I tried to use buttons to append a new record, or delete a record, but kept getting "index record read-only" whereas the DBNavigator works ok. I guess the DBNav is doing something extra - is it possible to call the methods directly ?
Thanks
Richard
They are linked to a table and I using Paradox 7.
One other thing - this is a detail file I have a secondary index in the record to display only certain records. I tried to use buttons to append a new record, or delete a record, but kept getting "index record read-only" whereas the DBNavigator works ok. I guess the DBNav is doing something extra - is it possible to call the methods directly ?
Thanks
Richard
Paradox 7 should not be a problem.
What do you mean by 'this is a detail file I have a secondary index in the record ...' ? Do you mean you work with a filtered DataSet ?
Well, if you take a look at the code Borland provides with the dbnavigator, I just see that - when you click the insert-button - 1 line of code is executed : Insert.
And this triggers the OnNewRecord-Event of your DataSet. So the code is pretty straightforward in my opinion.
What do you mean by 'this is a detail file I have a secondary index in the record ...' ? Do you mean you work with a filtered DataSet ?
Well, if you take a look at the code Borland provides with the dbnavigator, I just see that - when you click the insert-button - 1 line of code is executed : Insert.
And this triggers the OnNewRecord-Event of your DataSet. So the code is pretty straightforward in my opinion.
Hi Diver999,
Have you already tested my suggestion of working with 2 tabsheets (one for a gridview and one for a recordview) ?
Best regards,
Wim.
Have you already tested my suggestion of working with 2 tabsheets (one for a gridview and one for a recordview) ?
Best regards,
Wim.
ASKER
Actually, your comments sent me off in a different direction, so were helpful.
The dataset I am working with is filtered - I still don't know why the secondary index record is showing as read-only...
But thanks for your help
Richard
The dataset I am working with is filtered - I still don't know why the secondary index record is showing as read-only...
But thanks for your help
Richard
Have you searched the web for your specific error-message ?
What kind of database do you use ?
When you press the Insert-button on the db-navigator, then the Insert-Method of your linked DataSet is triggered.
Visually (i.e. dbgrid), the new record is inserted from where your cursor was, but when you save the data, it will be positioned at its logical position (depending on which sort-order you use).
To work around this problem I always use a Form with a TPageControl on it.
This PageControl has 2 TTabSheets.
First Tabsheet contains a readonly DBGrid (User cannot edit/add items directly in the DBGrid).
Second tabsheet contains all the TDBEdit-Components (for every field that needs input).
When the user clicks on the Edit or Insert button of the navigator, focus the second TabSheet en let the user change the values in the TDBEdits.