1

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

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

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
Also, you have to refer to the function as a member of the form, e.g., Forms!MyForm.MyFunction().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.