rorymurray
Programmer
HI,
I have written a function that basically gets a translation value from a table and returns it. Now I want to use this function on a field in a query, but I keep getting a message of "compile error in query expression get_costctr_code([pdept])".
The code is below:
function get_costctr_code(pronto_cd as number) as number
dim rs as DAO.recordset
set db=currentdb()
set rs = db.openrecordset("select * from tblCostCtrTrans where PCode = " & pronto_cd)
rs.movefirst
get_costctr_code = rs("LCostCtrCode"
rs.close
end function
I don't know if the problem is with the way I've typed the function in the query (Expr1: get_costctr_code([pdept]) ), or the function itself.
Thaks in advance.
Rory
I have written a function that basically gets a translation value from a table and returns it. Now I want to use this function on a field in a query, but I keep getting a message of "compile error in query expression get_costctr_code([pdept])".
The code is below:
function get_costctr_code(pronto_cd as number) as number
dim rs as DAO.recordset
set db=currentdb()
set rs = db.openrecordset("select * from tblCostCtrTrans where PCode = " & pronto_cd)
rs.movefirst
get_costctr_code = rs("LCostCtrCode"
rs.close
end function
I don't know if the problem is with the way I've typed the function in the query (Expr1: get_costctr_code([pdept]) ), or the function itself.
Thaks in advance.
Rory