在MS Access表单中寻找一种方法来记住具有焦点的字段,将焦点按代码切换到其他字段(从用户请求条目),最后返回到最初具有焦点的fiels。我尝试了以下代码,但我尝试恢复焦点的所有内容都会产生错误:
Dim ctl As Control, prp As Property, hot As String, hit As Object
Set ctl = Screen.ActiveControl
hot = ctl.Name
…
hit = "Forms!" & hot
hit.SetFocus
答案 0 :(得分:0)
Me(hot).SetFocus
或
Dim hit As Control
Set hit = Me(hot)
hit.SetFocus
或只是保留ctl
:
ctl.SetFocus