"Method identifier" Expected in Excel Function

Add-in Express™ Support Service
That's what is more important than anything else

"Method identifier" Expected in Excel Function
 
Davide Crudo




Posts: 23
Joined: 2005-05-09
Sorry to bother you again ;) But I'm translating some functions from VB to Delphi using your add-in that I really start to like :))

When I try to compile the function below, I get "Method Identifier Expected"

I believe that maybe I cannot call object properties from inside a function...

1) how can I call components on the AddInModule? I need the variables
in the EDIT box and assign to a DB connection Object to run the function

2) Last time you told me to add a Second AddInModule to the project, but how can I do it? I Can only Add FORMs and Units... under Plug-in Express there is no icon for additional add in modules.

The function that give me problems is:

// DBConn is a Server Connection Object on the AddInModule
// It works fine inside a procedure but not from this function

function TA_Retrieve.DaveID(var ResultColumn, dbtable, dbwhere,
dbfunction: OleVariant): OleVariant;
Var strSQL,ResultRS : String;

begin

TAddInModule.DBConn.server := TAddInModule.adxCB.Controls[0].AsEdit.text;
TAddInModule.DBConn.Username := TAddInModule.adxCB.Controls[1].AsEdit.text;
TAddInModule.DBConn.Password := TAddInModule.adxCB.Controls[2].AsEdit.text;
TAddInModule.DBConn.Database := TAddInModule.adxCB.Controls[3].AsEdit.text;
TAddInModule.DBConn.connect;

[...]

Thank you again for your very useful support!

Davide
Posted 14 Jun, 2005 07:12:00 Top
Dmitry Kostochko


Add-in Express team


Posts: 2742
Joined: 2004-04-05
Hi Davide,

1) Use the COMAddInModule property. For example:

function TA_Retrieve.DaveID(...): OleVariant;
var
  Server: string;
begin
  Server := TAddInModule(Self.COMAddInModule).adxCB.Controls[0].AsEdit.Text;
end;


2) In fact I can't recall telling you about an additional AddInModule. May be we were speaking about standard TDataModule.

Posted 14 Jun, 2005 07:55:20 Top
Davide Crudo




Posts: 23
Joined: 2005-05-09
I cannot find the TDataModule in Delphi 2005...I remember I used it in D7 ...but I don't remember where to pick it up...
Posted 14 Jun, 2005 09:52:29 Top
Dmitry Kostochko


Add-in Express team


Posts: 2742
Joined: 2004-04-05
Hi Davide,

Usually it is in the New Items dialog box -> Delphi Projects -> Delphi Files. But Delphi 2005 IDE shows items in this dialog depending on the project type. So you can use the Customize New Menu dialog and drag-n-drop the Data Module item in any other place.


Posted 14 Jun, 2005 10:31:40 Top