“DoCmd.GoToRecord,acLast”救命 [英] "DoCmd.GoToRecord , , acLast" HELP
问题描述
我的数据库有一个表单,用于查看所选设备的维护。我从组合框中选择了设备项目;然后使用该设备项的所有相关维护(在equipmentID上链接的主/子字段)更新子表单。维护子表单位于数据表视图中。问题是:在主窗体的组合框中选择了设备项后,我无法弄清楚如何将维护子窗格转到最后一条记录。我想在主窗体上使用组合框的afterupdate事件。我只是无法弄清楚如何告诉子窗体转到子窗体的最后一条记录或setfocus。 ????????建议?
My database has a form used to view maintenance for selected equipment. I select the equipment item from a combo box; the subform is then updated with all the relevant maintenance for that equipment item (master/child field linked on equipmentID). The maintenance subform is in datasheet view. Here is the problem: I can''t figure out how to have the maintenance subform goto the last record after the equipment item is selected in the combo box on the main form. I thought to use the afterupdate event of the combo box on the main form. I just can''t figure out how to tell the subform to goto or setfocus on the last record of the subform. ???????? Advice?
推荐答案
这是我怎么做的。在MainForm上的ComboBox的AfterUpdate事件中,我会把:
''首先设置焦点到SubFormControl
Me.SubFormControl.SetFocus
''现在将焦点设置为SubForm上的控件
Me.SubFormControl.FORM.ControlName.SetFocus
''现在移动到SubForm的最后一条记录
DoCmd.RunCommand acCmdRecordsGoToLast
Here''s how I would do it. In the AfterUpdate event of the ComboBox on the MainForm I would put:
'' First set focus to SubFormControl
Me.SubFormControl.SetFocus
'' Now set focus to a control on the SubForm
Me.SubFormControl.FORM.ControlName.SetFocus
'' Now move to the last record of the SubForm
DoCmd.RunCommand acCmdRecordsGoToLast
谢谢,我试试吧。 控制是什么意思?在子窗体上?
Thank you, I''ll a try give it. What do you mean by a "control"? on the subform?
为什么不对子窗体进行降序排序?
因此最新的子窗体始终位于顶部。
Nic; o)
Why not sort the subform descending ?
Thus the most recent is always on top.
Nic;o)
这篇关于“DoCmd.GoToRecord,acLast”救命的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!