Here is the code I use. Windows will automatically open the registered application according to file type. Amend to your own circumstances.
To open a file displayed in a tablegrid by double clicking on a row.
procedure frmMain_tgDatasheets_OnCellDoubleClick (Sender: TObject; ACol, ARow: Integer);
var
fName :string;
begin
fName := SQLExecute('SELECT DISTINCT datasheetFile_Filename FROM Datasheets WHERE id = '+frmMain.tgDatasheets.SQLValue);
OpenFile(fName);
end;
If you are using a tablegrid to display the database entries, then just set that up using the standard tablegrid wizard in VDB.
I've attached an image of my program displaying two rows of information. Clicking on either of them will open a different document. One is a PDF and the other is a text item.
On a clear disk you can seek forever