Hoover effect, is it possible ?

I don't like writing code like this but to get as close to your syntax as I can it would be: -

Code:
Private Sub MySub()
 
    Call MyFunction(Forms("MyForm")("MySubForm").Controls("MyControl"))
 
End Sub
 
 
Function MyFunction(ControlName)
 
    ControlName.Visible = False
 
End Function
 
here is the code I wrote:

Code:
private sub MySub()
 
call MyFunction(FormLevel, "ControlName", "FormName", "SubFormName", "SubSubFormName")
 
end sub
 
Function MyFunction(FormLevel, MyControlName, MyFormName, Optional MySubFormName, Optional MySubSubFormName)
 
Select case FormLevel
  case 1
    forms(MyFormName).Control(MyControlName).visible = true
  case 2
    forms(MyFormName).Form(MySubFormName).Control(MyControlName).visible = true
  case 3
    forms(MyFormName).Form(MySubFormName).Form(MySubSubFormName).Control(MyControlName).visible = true
  case else
end select
 
end function

as I don't find the code you wrote less complex I'll stick with mine
unless there is simpler code available.
thanks.
 
>>I'll probably post some nice examples using your code in the Code Repository soon.<<

May I suggest, if you are going to write code like that, you leave my name out of your article.
 
>>I'll probably post some nice examples using your code in the Code Repository soon.<<

May I suggest, if you are going to write code like that, you leave my name out of your article.
He didn't want to adhere to good coding practices Chris :rolleyes: Not good. hehe!
 
>>I'll probably post some nice examples using your code in the Code Repository soon.<<

May I suggest, if you are going to write code like that, you leave my name out of your article.

I know my code is not the best, and that's why I asked what is the best way to do that.
and that's why I wrote ... unless there is simpler code available...
I want this code to be for many forms, including sub forms.

I'll totaly ignore vbaInet comment which only ment to insult.
 
Lighten up smig! We have a little banter on here sometimes.:D

Here's what would have prompted Chris' response
as I don't find the code you wrote less complex I'll stick with mine
 
because I need to send more data to the function (not only the end control name) I prefer writing a more complex function (that do the work perfectly) and make it simpler to send the data to it, where it's easier for me to see what I send.

the end result I made is more complex, as sometimes the hover effect is done by changing the visibility of a box around the button, sometimes changing the button's text color, and sometimes changing the button icon.

I'm probably not the best coder (as all I learned I learned by myself - PC computers where not exist when I finished school).
for me having something like this:
call MyFunction(FormLevel, "ControlName", "FormName", "SubFormName", "SubSubFormName")
is more clear and readable then having something like this:
Call MyFunction(Forms("MyForm")("MySubForm").Controls("MyControl"))

unless I can put all this:
Forms("MyForm")("MySubForm").Controls("MyControl")
into a variable and send the varaible to the function.
 
I see your point. You do what you can understand and what you find readable because it would be you maintaining the db. :)

It's the bit about you posting the article with his name on it that he wouldn't like (if the code doesn't meet his requirements).
 
no. I won't post the code as his.
I'll never post my code as someone else one.
I just give credit for the help.
his example gave me a lot of help doing it. I changed the code alot to meet my requirements, but it gave me a good start.

but if wished I can give no credit
 
Maybe he would allow you give him some credits indirectly. Ask him when he's next online.
 
Smig.

The reason I suggested you leave my name out of your article is because the code you have so far presented here is not mine.
I think it is a good idea to give credit where it is due but, in this case, it is simply not due.
 
Or you can just put a space in the control's hyperlink property! ;)
 

Users who are viewing this thread

Back
Top Bottom