Invalid Pointer problem 
Author Message
 Invalid Pointer problem

Hi,

I am using delphi 1.0 to create a program that allows users to update a
database within a grid (InfoPower)...so far no problem.  However, I am
using a query to get the records so the user can sort without having to use
only indexed fields.  

I have two date fields they wanted to be able to update like in a
spreadsheet...they want to be able to click on the first cell with the
correct entry, click on the last cell they want changed, and the date from
the first cell with the correct entry to populate all the other selected
fields.

I have been able to get the rows selected and actually perform the change
once.  However, if I try to perform the change a second time, I get a
'Invalid Pointer Operation' and the code stops on the Freebookmark method
inside the loop.

This is the code I am using:

procedure TfrmMain.btnChangeEffDateClick(Sender: TObject);
var
  i: integer;
  NewDate: TDateTime;
begin
  If qryBeal.CanModify then
  begin
    with wwDBGrid1, qryBeal do begin
      DisableControls;
      {grab the first selected records effective date}
      GotoBookmark(SelectedList.items[0]);
      NewDate := qryBealEffDate.AsDateTime;
      Freebookmark(SelectedList.items[0]);
      for i := 0 to SelectedList.Count-1 do begin
        GotoBookmark(SelectedList.items[i]);
        Freebookmark(SelectedList.items[i]);
        qryBeal.Edit;
        qryBealEffDate.asdatetime := NewDate;
        qryBeal.Post;
      end;
      SelectedList.clear;
      EnableControls;
    end;
  end;
end;

Any suggestions would be appreciated.

Jay B.

-------------------------------------------------
Man's mind stretched to a new idea
never goes back to its orginal dimension.
      ==Oliver Wendell Holmes==
-------------------------------------------------



Wed, 23 Jun 1999 03:00:00 GMT  
 Invalid Pointer problem

Quote:

> <snipped>


database (and complaining that they cannot do things the database was
designed for), now they want a database with spreadsheet
functionality... :-D

Quote:
> I have been able to get the rows selected and actually perform the change
> once.  However, if I try to perform the change a second time, I get a
> 'Invalid Pointer Operation' and the code stops on the Freebookmark method
> inside the loop.

Was that in the same run or before disabling and enabling the controls
again? It seems that disabling the controls looses the bookmarks,
apart from being invalidated when the dataset is closed or its index
changed.
Otherwise, it might be that they're invalidate too when leaving
browse-state, as you probably do to update the fields (or should I say
cells :-(). Remember the Note on the Bookmark property: it hits me
more often than not. "The contents of the bookmark string is opaque
and volatile:  do not modify the contents of bookmarks or store them
beyond the active lifetime of the dataset they refer to."

Good luck!

Jasper



Wed, 23 Jun 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Invalid Pointer Operation after FPC 1.00 installation and an Ansistring problem

2. Invalid pointer operation

3. dipose [Invalid Pointer operation]

4. Invalid pointer operation???!!!

5. pointers, pointers, pointers...

6. Pointers Pointers Pointers

7. "Invalid BLOB Handle" problem

8. query problem foxpro: Invalid parameter

9. HELP! Invalid filename problem

10. Problem: Index invalid

11. !Help with DLL 'Invalid Pointer Operation problems'!

12. Pointers to pointers

 

 
Powered by phpBB® Forum Software