Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting a query to run a function

Status
Not open for further replies.

irishjoe

Programmer
Aug 5, 2002
76
AU
Hi,

I am trying to get rid of all the calculated values in my database. Some of the calculations are quite complicated so I was wondering the following was possible.

Have a function like this...
Public Sub calcScore(q As Integer, q As Double)

If q = 1 Then
calcScore = q
Else
calcScore = 0
End If

End Sub

And then in the query...
Score: calcScore([StructuralQ1],[StructuralQ1Weight])

StructuralQ1 and StructuralQ1Weight are values in the query.

The error message is duplicate defination in current scope.
I have checked and "calcScore" doesnt appear anywhere else in the database.


If anyone can point me in the right direction, it would be greatly appreciated.
 
Is this correct ?

Code:
Public Sub calcScore([b]q[/b] As Integer, [b]q[/b] As Double)

or just mistyped ?
 
Thats it!!!
You don't want to know how long I have been staring at the database wondering what was wrong!

It was meant to be
Public Sub calcScore(q As Integer, w As Double)
instead of
Public Sub calcScore(q As Integer, q As Double)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top