-2

When looking to move the pointer on to the next record, an error message is shown that says:

Access violation at address 004070E2 in module 'main_p.exe'. Write of address 00000000

Any way of resolving this?

var
  i: integer;
begin
  with dmData.dmEventInfo do
  begin
    tblEventinfo.Open;
    i := 0;
    while NOT tblEventinfo.Eof do
    begin
      arrNames[i] := tblEventinfo['bandname'];
      tblEventinfo.Next;
      i := i + 1;
    end;

  end;
end;
Fabrizio
  • 7,603
  • 6
  • 44
  • 104
Philip Ellis
  • 53
  • 1
  • 5

1 Answers1

3

You don't show the declaration of the arrNames array , but I think the problem was in the Length.

var
  i: integer;  arrNames : array of string;
begin
    SetLength(arrNames , tblEventinfo.RecordCount);
    i := 0;
    while NOT tblEventinfo.Eof do
    begin
      arrNames[i] := tblEventinfobandname.Value;
      tblEventinfo.Next;
      Inc(I);
    end;

  end;
Ilyes
  • 14,640
  • 4
  • 29
  • 55