Module code

bgcogen

Registered User.
Local time
Today, 02:08
Joined
Apr 19, 2002
Messages
61
Hi. Hope someone can help me??

I have the following code that I want to use to return a value:

Option Compare Database
Option Explicit

Function MW(MW_before, MW_after, Start_time, End_time)

MW = ((MW_before - MW_after) / MW_before) * (Start_time - End_time)

End Function

But when I use the command:
Expr1: MW([MW before],[MW during],[Resumption time],[Time of fault])
in a query box I get the error >
Function MW not recognised.

What am I doing wrong??
 
Try:

Expr1: =MW([MW before],[MW during],[Resumption time],[Time of fault])
 
A "Function" is a piece of code that returns a value. Typical specification of a function is:
Function Blah(parm1, parm2) As Integer
(or As String, Long, etc)

If you wish to use Blah in the criteria box of a query, type in the function name
Blah(parm1, parm2)

If you wish to use blah from code,
intReturnCode = Blah(parm1,parm2)

RichM
 

Users who are viewing this thread

Back
Top Bottom