Open Different Paradox Table using same Table Component
I want to add File - Open functionality to an application that will have
multiple Paradox Tables (of the same structure). I want to attach the
actual Paradox Tables (in different directories) to the table component on
my form. Does anyone have sample code that does this. The code I
currently have that does not work is as follows:
procedure TfrmTransactionProcessing.mnuOpenClick(Sender: TObject);
var
strAliasPath: String;
begin
OpenDialog.Title := 'Open Database';
OpenDialog.Filter := 'Database files (*.db)|*.DB';
OpenDialog.DefaultExt := 'DB';
OpenDialog.FileName := '';
if OpenDialog.Execute then
begin
strAliasPath := ExtractFileDir(OpenDialog.FileName);
// Set Database Alias.
// Database.Connected := False;
tblTrans.Close;
Database.Connected := False;
Database.Params.Clear;
Database.Params.Add('PATH='+strAliasPath);
tblTrans.TableName := ExtractFileName(OpenDialog.FileName);
// Database.Connected := True;
tblTrans.Open;
end;
end;
The result of this code is that the table does not change from the table
that was originally opened when the form was created. Please help.
Best Regards,
Michael McDonald :)