Himie 0 Posted May 27, 2021 Members 0 2 posts Report post Posted 3 hours agoHi There Hi There (Reposting here as think might reflect more on databases than datasets where posted previously) I am using (or trying to use) FDMemTables and it is not cooperating. I am using the Community edition of Delphi 10.3 with Windows 10. I have a DataModule in which I have placed the respective FDMemTables and in the OnCreate event I have put the Field Definitions and create the table as below: with fdmAdmin.FieldDefs do begin // fdmAdmin clear; Add('ID',ftString,4); Add('Num',ftString,4); Add('SaveLocation',ftString,80); Add('LastPurchOrder',ftString,30); Add('LastInvoice',ftString,30); Add('LastReceipt',ftString,30); Add('CurrentJournal',ftString,30); end; fdmAdmin.CreateDataSet; In another Unit (which references the DataModule1 in its Implementation Uses) I have the following code: DataModule1.fdmAdmin.Active := true; if DataModule1.fdmAdmin.RecordCount < 1 then begin // if no records means starting and no saving previously done DataModule1.fdmAdmin.Append; DataModule1.fdmAdmin.Edit; DataModule1.fdmAdmin['LastInvoice'] := '0000'; DataModule1.fdmAdmin['LastPurchOrder'] := '0000'; DataModule1.fdmAdmin['LastReceipt'] := '0000'; DataModule1.fdmAdmin.Post; end; I get the message 'Cannot open dataset [TFDMemTable]. A DataTable or a DataView must be supplied. Hint: if this is a TFDMemTable, use CreateDataSet or CloneCursor to open dataset.' There is a CreateDataSet in the DataModule1 code. Anyone point me in the right direction here? Thanks heaps. Himie Share this post Link to post
ergeka 5 Posted May 27, 2021 Is the option 'CachedUpdates' activated? Ralf Share this post Link to post
Himie 0 Posted May 27, 2021 Hi Ralf No, I have not referenced the CachedUpdates at all Cheers Himie Share this post Link to post
Lajos Juhász 293 Posted May 27, 2021 3 hours ago, Himie said: I get the message 'Cannot open dataset [TFDMemTable]. A DataTable or a DataView must be supplied. Hint: if this is a TFDMemTable, use CreateDataSet or CloneCursor to open dataset.' There is a CreateDataSet in the DataModule1 code. Anyone point me in the right direction here? Thanks heaps. Place a break point in the DataModule most probably you didn't excecuted the code there and fdmAdmin.FieldDefs remains empty. That's the only way you get this error message. Share this post Link to post
Himie 0 Posted May 27, 2021 Thanks I hvae the DataModule1 in the auto-create forms part so should execute. Will investigate this further. Thanks for the tip. Himie Share this post Link to post