Privateer
Registered User.
- Local time
- Today, 18:16
- Joined
- Aug 16, 2011
- Messages
- 193
Let me start by saying I got this thing to work by putting my function in a module, but I want the code behind a form. So the question is this: If a form is open and a function is public, shouldn't a query be able to reference that function? Must it be in a module?
I have written a public function that resides on the form. When I try to reference the function in a query, Access says the function can't be found. The query is run from code behind a command button on the form, so the form will always be open, meaning to me, that the function will be available. When I tested this in a QBE window, and fully qualify the location in the query: ObjDis: Forms("frmObjectMenu").GetOjbDis(....) Access really hated having a dot there. Never got this to work.
I am importing this form into many other databases and I wanted all the necessary code on the form. I was hoping to avoid importing a module for two lines of code or copying it to an existing module. Any information would be appreciated.
Thanks, Privateer
I have written a public function that resides on the form. When I try to reference the function in a query, Access says the function can't be found. The query is run from code behind a command button on the form, so the form will always be open, meaning to me, that the function will be available. When I tested this in a QBE window, and fully qualify the location in the query: ObjDis: Forms("frmObjectMenu").GetOjbDis(....) Access really hated having a dot there. Never got this to work.
I am importing this form into many other databases and I wanted all the necessary code on the form. I was hoping to avoid importing a module for two lines of code or copying it to an existing module. Any information would be appreciated.
Thanks, Privateer