R
Rebecca
Hi out there,
I have a routine that takes values from a multi-column
combobox and loads them into a recordset. I need to call
this routine for different comboboxes, so instead of
hardcoding the name of the combobox in the routine, I want
to put it into an object variable and pass the variable to
the routine.
Soooo, the routine that uses the combobox variable works
fine if I initialize and set the variable within that
routine (which is interesting, but doesn't accomplish what
I need). But when I try to pass the value to the routine,
it blows up. The code that passes the value is called from
an event and looks something like this...
Private Sub MyBtn_Click()
Dim MyCombo as Combobox
set MyCombo = me.ComboBoxName
MyRoutine(MyCombo)
end sub
When I call the routine I get an "Object Required" error
on the line that calls MyRoutine. The debugger seems to
indicate that MyCombo is getting the value of what's in
the combo box and not a reference to the combo box itself.
So my conclusion is that the problem lies in passing the
parameter to the routine, like it's somehow trying to pass
by value instead of by reference. I tried specifying ByRef
in the routine that gets passed the value, but to no avail.
Any ideas??
Thanks!
Rebecca
I have a routine that takes values from a multi-column
combobox and loads them into a recordset. I need to call
this routine for different comboboxes, so instead of
hardcoding the name of the combobox in the routine, I want
to put it into an object variable and pass the variable to
the routine.
Soooo, the routine that uses the combobox variable works
fine if I initialize and set the variable within that
routine (which is interesting, but doesn't accomplish what
I need). But when I try to pass the value to the routine,
it blows up. The code that passes the value is called from
an event and looks something like this...
Private Sub MyBtn_Click()
Dim MyCombo as Combobox
set MyCombo = me.ComboBoxName
MyRoutine(MyCombo)
end sub
When I call the routine I get an "Object Required" error
on the line that calls MyRoutine. The debugger seems to
indicate that MyCombo is getting the value of what's in
the combo box and not a reference to the combo box itself.
So my conclusion is that the problem lies in passing the
parameter to the routine, like it's somehow trying to pass
by value instead of by reference. I tried specifying ByRef
in the routine that gets passed the value, but to no avail.
Any ideas??
Thanks!
Rebecca