我正在尝试修改数据表标题上的标签。以下命令产生所需的结果:
Forms!mainform![mySubform].Form.Controls("Label47").Properties("Caption") = "Test47"
我的最终目标是使用变量在循环中修改一堆标签字幕。没有成功:
dim intLabel as integer
dim strLabel as string
intLabel = 47 'the first Label "Label47"
do while intLabel < 99
strLabel = "Forms!mainform![mySubform].Form.Controls('Label" & intLabel & "').Properties('Caption') = 'Test" & intLabel & "'"
Eval (strLabel)
intLabel - intLabel + 1
Loop
完成此任务的任何建议?
答案 0 :(得分:1)
我会忘记尝试使用Eval
并直接分配值:
dim intLabel as Long
dim strLabel as String
intLabel = 47 'the first Label "Label47"
Do While intLabel < 99
Forms!mainform![mySubform].Form.Controls("Label" & intLabel).Properties("Caption") = "Test" & intLabel
intLabel - intLabel + 1
Loop