Hi,
I've got my L'plates on and am having a bit of trouble passing objects to subroutines.
I'm sure I am missing some basic concept, but all the wading through help files and doco hasn't shed any light for me.
I have a form with a checkbox on it, I am trying to pass a checkbox to a subroutine. For instance,
sub dosomething(cb as checkbox)
'eg
if cb.value = true then
'do stuff
end if
end sub
I call using
dosomething(myCheckBox)
and on debug I find that the the mouseover gives me myCheckBox = false (or true) and an error saying an object is required is given.
I can get it working by passing the value instead, but my problem is understanding passing of objects generally, I think. Sorry of this is a no brainer for you all, but I don't get why if I'm telling a routine it should receive a CheckBox, and then sending what I believe is a CheckBox, doesn't work!? I have tried a few things and the problem seems to lie in VBA seeing the myCheckBox string as a value, not an object reference.
Please help the confused.
thanks,
Angelena
I've got my L'plates on and am having a bit of trouble passing objects to subroutines.
I'm sure I am missing some basic concept, but all the wading through help files and doco hasn't shed any light for me.
I have a form with a checkbox on it, I am trying to pass a checkbox to a subroutine. For instance,
sub dosomething(cb as checkbox)
'eg
if cb.value = true then
'do stuff
end if
end sub
I call using
dosomething(myCheckBox)
and on debug I find that the the mouseover gives me myCheckBox = false (or true) and an error saying an object is required is given.
I can get it working by passing the value instead, but my problem is understanding passing of objects generally, I think. Sorry of this is a no brainer for you all, but I don't get why if I'm telling a routine it should receive a CheckBox, and then sending what I believe is a CheckBox, doesn't work!? I have tried a few things and the problem seems to lie in VBA seeing the myCheckBox string as a value, not an object reference.
Please help the confused.
thanks,
Angelena