Cowboy_BeBa
Registered User.
- Local time
- Today, 22:42
- Joined
- Nov 30, 2010
- Messages
- 188
So ive written a bit of code that needs to be applied to each form on form load
its very basic, just changes an image source on each form (to one stored in a table) and the forms header colour
two lines of code
me.formheader.backcolor=dlookup,,,
me.recLogo.picture=dlookup...
now as these two lines of code are exactly the same and need to be applied to every form on the DB i thought it would be best to store them in a public function on a separate module, this way if ever i need to edit the code i just change it in one place instead of on every page (not to mention its a bit cleaner to have it in one spot than to have it copy/pasted on every form_load event)
the problem is the keyword "Me" has no meaning when used outside of a form or report
so my question is how do i replace "Me" with the currently active form?
ive done something similar in the past (albeit with one specific form), in which the code was something like
Forms!formName.ControlName.Property = whatever
But that doesnt apply here because the form name is subject to change
does anyone know what i can do to remedy this? thought of creating a variable as an object and then making the variable equal whatever the active form is, but not sure how to actually do that last part
is what im attempting even possible?
its very basic, just changes an image source on each form (to one stored in a table) and the forms header colour
two lines of code
me.formheader.backcolor=dlookup,,,
me.recLogo.picture=dlookup...
now as these two lines of code are exactly the same and need to be applied to every form on the DB i thought it would be best to store them in a public function on a separate module, this way if ever i need to edit the code i just change it in one place instead of on every page (not to mention its a bit cleaner to have it in one spot than to have it copy/pasted on every form_load event)
the problem is the keyword "Me" has no meaning when used outside of a form or report
so my question is how do i replace "Me" with the currently active form?
ive done something similar in the past (albeit with one specific form), in which the code was something like
Forms!formName.ControlName.Property = whatever
But that doesnt apply here because the form name is subject to change
does anyone know what i can do to remedy this? thought of creating a variable as an object and then making the variable equal whatever the active form is, but not sure how to actually do that last part
is what im attempting even possible?