Himie 0 Posted May 27, 2021 Hi There 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) if 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
Carlos Tré 9 Posted June 3, 2021 Hi @Himie Have you sorted this out already? Just out of curiosity I tested the code above in a FMX project, and it worked just fine - Delphi 10.4.2 Enterprise, Windows 10. I really can't tell why it wouldn't work in 10.3 Community ( but I'm no Delphi guru 🙂 ). Share this post Link to post
Himie 0 Posted June 3, 2021 Hi Carlos Thank you for your response. I'm no Delphi Guru either, just plug away and spend a lot of time trying to get it to work. I have worked around the issue it seems that something was not working properly with the DataModule part of the program where it was not going right through the code section of that module. I spent weeks endeavouring to get it to work and finally had to put all the FDMemTables onto a form and use the code section of the form to define and create the tables (instead of using the DataModule). It then worked fine. Cheers Himie Share this post Link to post