热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Access2003VBA:自定义表单属性问题-Access2003VBA:customformpropertyproblem

IhavearegularformcalledFish.IthasaTreeCtlcalledloctreewhichIusedasalocationch

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.

我有一个名为“鱼”的常规表格。它有一个名为“loctree”的TreeCtl,我用它作为位置选择器来更改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:

我已经为Fish添加了几个子表单。其中两个有我想使用loctree的位置字段。由于我不想为每个子表单实例化一个新的TreeCtl,我想我可以让loctree知道它当前目标是哪个控件。我认为定义当前目标的最简单方法是在Fish表单中添加一个属性:

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:

然后在Fish窗体的Open事件中,我可以设置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

相同属性的属性过程的定义不一致,或者属性过程具有可选参数,ParamArray或无效的Set final参数

So what gives?

什么给出了什么?

Thanks, Jen

1 个解决方案

#1


IIRC, your properties should look like

IIRC,你的房产应该是这样的

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?

那样有用吗?


推荐阅读
author-avatar
鐘文斌kebenJ
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有