开发者

Query "where clause" fails when calling a function

I have a function in Access VBA that takes four parameters.The fourth parameter is a "where clause" that I use in an SQL statement inside the function. The function fails when I include the fourth parameter (where clause). When I remove this fourth parameter, the function just works fine. I am not sure if there is anything wrong with the syntax of the fourth parameter ? Please help. here is the function as called in the Query

FunctionA('Table1','Field1',0.3,'Field2=#' & [Field2] & '# and Value3="' & [Value3] &开发者_如何转开发 '"') AS Duration_Field


I would split Field2 and Value3 out into separate parameters for your function. Passing parameters like that is just asking for trouble.

I'd rewrite the function along these lines:

FunctionA('Table1','Field1',0.3,'Field2','Value3') AS Duration_Field

Then handle the combining of the parameters in the function itself instead of in the function call.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜