MS Access 2007:是否可以(使用 VBA 或类似的东西)获取打开的表或打开的查询结果中的选定行?

发布于 2024-11-08 07:56:23 字数 139 浏览 0 评论 0原文

这个问题的标题说明了一切,我正在寻找一种方法来实现这一目标。是否可以?

另外,如果这无法实现,是否有其他方法可以将用户选择的 ID 从表/查询传递到表单(即打开表单不是问题,使用超链接字段,传递单击的内容的值是棘手的部分)。

谢谢。

the title to this question says it all, I am looking for a way to achieve this. Is it possible?

Also, if this wouldn't be achievable, are there maybe any other ways in which I can pass the user selected ID from a table / query to a form (i.e. opening the form is not a problem, using the hyperlink field, passing the value of what was clicked is the tricky part).

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

伴梦长久 2024-11-15 07:56:24

通常认为让用户直接访问表或查询结果是不好的做法。您通常应该构建一个表单,其中

  1. 包含带有表/查询结果的列表,或者
  2. 是绑定到表/查询的连续表单

然后用户可以从表单中选择他们想要的项目,并且表单可以发送该项目选择其他形式。

It is generally considered poor practice to give users direct access to tables or the results of queries. You should generally build a form that either

  1. contains a list with the results of the table/query, or
  2. is a continuous form bound to the table/query

The user can then select which item they desire from the form, and the form can send that selection to the other form.

白龙吟 2024-11-15 07:56:24

在 Excel 中,您将捕获事件 SheetSelectionChange,因此只是其简短内容:

'Variable for trapping events in Excel application.
Private WithEvents mxlApp As Excel.Application  

Private Sub mxlApp_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
    'Do stuff here.
End Sub

我认为在 Access 中它会类似。我以前没有用VBA for Access 编程过,但应该是类似的。

以下是一些资源:

http://www.cpearson.com/excel/appevent.aspx

http://www.cpearson.com/excel/Events.aspx

In Excel you would capture the event SheetSelectionChange so just the short of it:

'Variable for trapping events in Excel application.
Private WithEvents mxlApp As Excel.Application  

Private Sub mxlApp_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
    'Do stuff here.
End Sub

I would think it would be something similar in Access. I haven't programmed in VBA for Access before, but it should be similar.

Here's some resources:

http://www.cpearson.com/excel/appevent.aspx

http://www.cpearson.com/excel/Events.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文