Tag your it! help with mundane repetative code...

  • Thread starter Thread starter DawnTreader
  • Start date Start date
D

DawnTreader

Hello All

i was wondering, is there a way to create a system to "tag" a field on a
form, then when i have code that i want to happen again and again use the
"tag" to complete the action i want the code to do?

for example i have forms where i have fields that i make invisible, but the
users can still click on. i lock it but they still can click on it. even
though they cant do any data damage, it still looks bad. the field becomes
"highlighted" and so i use a combination of code a field to set the focus
from the clicked on hidden locked field to something where the user can
actually effect something. the following code is an example:

private sub txtMyHiddenField_Click()
me.txtTheFieldWhereTheyShouldBe.setfocus
end sub

that code became annoying to do repetatively so i though maybe that i could
create a sub that did the "bouncing".

so now i have this code in my forms:

private sub txtMyHiddenField_Click()
Call BounceMe
end sub

private sub BounceMe()
me.txtTheFieldWhereTheyShouldBe.setfocus
end sub

but now i think to myself, what if i could put a "tag" on a field on each
form so that i could make one function BounceMe in a module and then call
that on the form on the fields that i dont want users to click on, then i
wouldnt have a bounceme on each form and i would have less to set.

even better, if i could tag each field that i dont want users to click on
and then have one piece of code on the form to call the global function, i
would be thrilled.

any ideas? or am i just smashing my head against a brick wall?
 
DawnTreader said:
i was wondering, is there a way to create a system to "tag" a field on a
form, then when i have code that i want to happen again and again use the
"tag" to complete the action i want the code to do?

for example i have forms where i have fields that i make invisible, but the
users can still click on. i lock it but they still can click on it. even
though they cant do any data damage, it still looks bad. the field becomes
"highlighted" and so i use a combination of code a field to set the focus
from the clicked on hidden locked field to something where the user can
actually effect something. the following code is an example:

private sub txtMyHiddenField_Click()
me.txtTheFieldWhereTheyShouldBe.setfocus
end sub

that code became annoying to do repetatively so i though maybe that i could
create a sub that did the "bouncing".

so now i have this code in my forms:

private sub txtMyHiddenField_Click()
Call BounceMe
end sub

private sub BounceMe()
me.txtTheFieldWhereTheyShouldBe.setfocus
end sub

but now i think to myself, what if i could put a "tag" on a field on each
form so that i could make one function BounceMe in a module and then call
that on the form on the fields that i dont want users to click on, then i
wouldnt have a bounceme on each form and i would have less to set.

even better, if i could tag each field that i dont want users to click on
and then have one piece of code on the form to call the global function, i
would be thrilled.


I have never heard of a form control with its Visible
property set to False that can receive the focus. So I
don't understand what you are seeing much less how to work
around it..
 
Back
Top