在MS Access中设置焦点 [英] Setting focus in MS Access

查看:119
本文介绍了在MS Access中设置焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从Qdefs创建一个记录集,然后以表格形式显示记录.

I am creating a recordset from a Qdefs and then displaying the records in a form.

当我过滤值时,焦点将移到第一条记录.但是,我希望焦点指向过滤之前焦点所在的同一记录.

When I filter the values, focus is going to the first record. But, I want the focus to point to the same record that was in focus before filtering.

这是在过滤前后根据现有的查询定义创建记录集的方式

This is how am creating a recordset from an existing querydefs before and after filtering

db.QueryDefs("Query_vinod").Sql = filter
Set rs_Filter_Rowsource = db.OpenRecordset("Abfr_SSCI_Check_Findings_List")

推荐答案

我认为您可以通过使用书签来做到这一点.设置一个RecordsetClone,然后使用FindFirst方法找到您的活动记录.我有一些示例代码需要进行一些修改以适合您的确切变量:

I think you can do this by using a bookmark. Set up a RecordsetClone and then find your active record by using the FindFirst method. I have some sample code that will need to be modified a little to fit your exact variables:

Dim Rs As Recordset
Dim Test As Integer
Dim varBookmark As Variant

DoCmd.OpenForm "Contracts"


Set Rs = Forms!Contracts.RecordsetClone

    Rs.FindFirst ("[ID] = '" & Me![ID] & "'")

varBookmark = Rs.Bookmark
Forms!Contracts.Form.Bookmark = varBookmark

If Rs.NoMatch Then
  MsgBox "That does not exist in this database."
Else
End If

这篇关于在MS Access中设置焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆