• Homework
  • Thirds
  • Upper Thirds
  • Fourth
  • Divisions
    • ICT
    • Computer Science
  • Fifth
  • Lower Sixth
  • Upper Sixth
    • Upper Sixth Theory
  • Blog
  • Careers
  • Unity
  • Networking

Delphi and Access walkthrough

Navigating, adding and deleting under program control

The standard Navigator is a bit clumsy really.  It's not the kind of think you would probably design yourself.  In this section we'll replace its function with some buttons of our own.
Picture
Here are five navigation buttons and some example code for each of the buttons below.
procedure TForm3.nextButtonClick(Sender: TObject);
begin
  FDQuery1.Next;
end;

procedure TForm3.previousButtonClick(Sender: TObject);
begin
  FDQuery1.Prior;
end;

procedure TForm3.addButtonClick(Sender: TObject);
begin
  FDQuery1.Insert;
end;

procedure TForm3.deleteButtonClick(Sender: TObject);
begin
  FDQuery1.Delete;
end;

procedure TForm3.reportButtonClick(Sender: TObject);
begin

  memo1.Clear;
  FDQuery1.Open();
  FDQuery1.FindFirst;
  while not FDQuery1.Eof do
  begin
    memo1.Lines.Add(datasource1.DataSet.FieldByName('UserName').AsString +
    ' ' + datasource1.DataSet.FieldByName('Surname').AsString +
    '  ' + datasource1.DataSet.FieldByName('UserScore').AsString);
    FDQuery1.Next;
  end;
end;

Powered by Create your own unique website with customizable templates.