views:

87

answers:

1

Hello,

I know if I make a code module in Access and place a function in it, I can run a query that has embedded calls to that function. However, I want to know if I can get a function that belongs to the code part of a form to be recognized by Access in a query. So far I cannot find a way, but it seems to me that this should be possible.

Thanks, Cameron

+2  A: 

You can - the function has to be made PUBLIC and the form must be OPEN when you run the query.

Most of the time I put all common functions in a separate code module.

DJ
Oooh. Thanks! The reason I want to keep as much code belonging the form as possible is because everything I do will eventually have to be copy-pasted into different databases... So I'm trying to keep everything tied to a few necessary forms
Cameron
Also, you have to refer to the function as a member of the form, e.g., Forms!MyForm.MyFunction().
David-W-Fenton