Function as a control source?

L

LAS

I have a text box and have put in the Control Source property "=
fncProblemName("4")" This function should return "Staying on Task", but
the text box appears empty. If I try to type in it, though, each keystrok
produces a little bell and nothing is typed. A break in the function code
is not executed.

On the other hand, if I put txtBox = fncProblemName("4") in the OnLoad event
of the form, the break point is executed and the return value shows up.

Can anyone tell me what I'm doing wrong in my use of the Control Source?
 
K

Ken Snell

Double up the " characters that delimit the argument for the function:

Control Source property "= fncProblemName(""4"")"
 
D

David W. Fenton

Double up the " characters that delimit the argument for the
function:

Control Source property "= fncProblemName(""4"")"

....or just use single quotes:

"= fncProblemName('4')"

It only matters if you're passing a parameter that's based on a data
field that might have an apostrophe in it.
 
L

LAS

Thanks to both of you!

David W. Fenton said:
...or just use single quotes:

"= fncProblemName('4')"

It only matters if you're passing a parameter that's based on a data
field that might have an apostrophe in it.
 
Top