在单独的表单上双击打开表单到特定记录 [英] Open form to specific record as double-clicked on separate form

查看:87
本文介绍了在单独的表单上双击打开表单到特定记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,现在我需要打开一个表单(frmTopics)并选择在单独的表单中双击的相同记录(frmTopicsFound)。以下是详细信息:


frmTopicsFound包含数据表子表单sfrmTopicsFound。 sfrmTopicsFound是从查询中填充的,该查询根据关键字搜索返回主题列表。我希望用户能够双击sfrmTopicsFound中的一行并将frmTopics打开到同一记录。 frmTopics可能已经或可能没有开放。


基本上,我需要在sfrmTopicsFound.nbrTopID的OnDlbClick事件上使用一些代码:


1.打开frmTopics,如果它还没有打开

2.显示来自tblTopics的记录,其中tblTopics.topID = Forms!sfrmTopicsFound!nbrTopID


我确定已经这样做了,如果有人能指出我的一些示例代码,也许我可以从那里拿走它。谢谢!

Okay, now I need to open a form (frmTopics) and select the same record that has been double-clicked on in a separate form (frmTopicsFound). Here are the details:

frmTopicsFound contains datasheet subform sfrmTopicsFound. sfrmTopicsFound is populated from a query that returns a list of topics based on a keyword search. I want users to be able to double-click a row in sfrmTopicsFound and have frmTopics open to that same record. frmTopics may or may not not be open already.

So basically, I need some code on the OnDlbClick event for sfrmTopicsFound.nbrTopID that will:

1. Open frmTopics if it''s not already open
2. Display the record from tblTopics where tblTopics.topID = Forms!sfrmTopicsFound!nbrTopID

I''m sure this has been done so if anyone could point me to some sample code, maybe I can take it from there. Thanks!

推荐答案

基本上,在双击事件过程中,您将调用窗体的打开,但将WhereCondition设置为标识所选记录的字符串。
Basically, in the Double-click event procedure you would call the open of the form but with a WhereCondition set to a string which identifies the record selected.
展开 | 选择 | Wrap | 行号


顺便说一句,我使用 Me.nbrTopID 而不是表格! sfrmTopicsFound!nbrTopID 因为,大概是代码在控件包含的相同形式下运行。
By the way, I used Me.nbrTopID rather than Forms!sfrmTopicsFound!nbrTopID as, presumably, the code runs within the same form as the control is contained in.


当我双击该字段时,我得到一个参数框,我在哪里必须手动输入我在sfrmTopicsFound中双击的主题ID。显然,sfrmTopicsFound.nbrTopID中的值未被读入参数。手动输入主题ID后,frmTopics中会显示正确的主题。这是我的代码行:

When I double click the field, I am getting a parameter box, where I have to manually enter the topic ID that I double-clicked on in sfrmTopicsFound. So apparently the value in sfrmTopicsFound.nbrTopID is not being read into the parameter. After I manually enter the topic ID, the correct topic appears in frmTopics. Here is my line of code:

展开 | 选择 | Wrap | 行号


这篇关于在单独的表单上双击打开表单到特定记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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