vba - MS Access VBA - Runtime Error 438 when setting ControlSource-Property in Form
问题描述
After years of MS-Access
abstinence, I decided to help a friend manage guesthouse bookings by writing a database for him.
To display bookings, I am building a form frmHello
like this:
Mon, Dec 2 Tue, Dec 3 Wed, Dec 4
--------------------------------------------
room 1 [Smith ] [Smith ] [Smith ]
--------------------------------------------
room 2 [ ] [ ] [Miller ]
--------------------------------------------
room 3 [ ] [Adams ] [ ]
[xxx ]
are unbound textboxes. frmHello
is unbound, on_load
I call Sub Init()
to organize the data in a (temporary) table tblHello
, then bind frmHello
to tblHello
and bind the textboxes to their specific fields in tblHello
in Sub bind()
.
And this is where the mess started: Microsoft Visual Basic
keeps reporting a runtime-error 438: object doesn't support property or method
and marks line 5 below:
1 Private Sub bind()
2 Me.Recordsource = "tblHello"
3 For n = 0 to 3
4 Me("txtBooking" & n).ControlSource = "helloBooking" & n
5 Me("txtStatus" & n).ControlSource = "helloStatus" & n <------- marked line
6 Next
...
Note that line 4 runs perfectly...
What I've tried:
- deleted the
For ... Next
loop and wrote out all the textboxes' names and fields by hand - double-checked all names etc.
---> same error :-(
Who can help, please?
I'm running Access 2019 64bit on Win 10.
解决方案
推荐阅读
- excel - Excel VBA:将变量分配给 AdvancedFilter 结果中的第一个单元格的值
- reactjs - 尝试更新 React Hooks 中的对象数组时丢失输入焦点
- mongodb - 如何在ubuntu16.04上安装mongodb 3.2版本
- django - Django - 在可以使用这种多对多关系之前,需要为字段“id”设置一个值
- javascript - 当服务器位于不同时区时,React/JS toStringLocale 向用户返回不正确的时间
- python - 从 TensorFlow 到 ONNX - 保存/冻结图形或转换 pkl?
- javascript - 结合两个不同的 JavaScript 函数来获取 JSON 兄弟数据
- javascript - Wordpress wp.media 上传图片
- vue.js - 延迟加载 - 它何时下载块文件?
- php - 我的上传文件没有将 pdf 扩展名保存在上传文件夹中,而是将名称保存在数据库中。它仅将图像保存在上传文件夹中