views:

247

answers:

1

I have a regular form called "Fish". It has a TreeCtl called "loctree" which I used as a location chooser to change a field in Fish.

I've since added several subforms to Fish. Two of these have location fields that I would like to use loctree for. Since I didn't want to instantiate a new TreeCtl for each of these subforms, I thought I could just let loctree know which control its current target is. I thought the easiest way to define the current target would be to add a property to my Fish form:

Option Compare Database

Private locfield As Field

Property Let loc_focusField(target As Field)
    locfield = target
End Property

Property Get loc_focusField()
    loc_focusField = locfield
End Property

And then in the Open Event for the Fish form, I could set the default value of locfield:

Private Sub Form_Open(Cancel As Integer)
  locfield = Forms!fish_moves!fish_moves_loc_id
End Sub

Unfortunately, every time I try to open my form I get the following error:

Definitions of property procedures for the same property are inconsistent, or property procedure has an optional parameter, a ParamArray, or an invalid Set final parameter

So what gives?

Thanks, Jen

+3  A: 

IIRC, your properties should look like

Property Set loc_focusField(target As Field)
    set locfield = target
End Property

Property Get loc_focusField() as Field
    set loc_focusField = locfield
End Property

Does that work?

shahkalpesh