单击时在 Access 2013 列表框中显示小预览图片 [英] Show Small Preview Picture in Access 2013 List Box On Click

查看:52
本文介绍了单击时在 Access 2013 列表框中显示小预览图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Access 数据库,里面有一个存储一堆文件的表.我创建了一个表单来通过各种关键字搜索文件.搜索后,结果显示在列表框中 - 用 VBA 编码.如果我双击特定结果,它会打开文件的路径(比如 PDF 文档).我想这样做,如果我只在特定结果上单击一次,它就会在表单的角落显示一张小图片.我将如何进行编码?

解决方案

假设路径名是文件或网站(或网站上的文档)或本地计算机上的某个文档的 url?

假设列表框的sql源是3列,

Id 描述 FullPathName

可能在上面,虽然列表框很可能基于 3 列,但您可以隐藏用于驱动列表框的查询的 id 和 FullPathName.

接下来只需在上角放置一个 Web 控件并根据需要调整其大小(Web 控件是理想的,因为它可以显示图片、网站、PDF、word 文档以及您的计算机可以呈现的任何其他内容).

然后在列表框的更新后,使用此 VBA 代码:

 Private Sub List0_AfterUpdate()Dim s 作为字符串s = "=(" & """" & Me.List0.Column(2) & """" & ")"Me.WebBrowser2.ControlSource = s结束子

I have an Access database with a table that stores a bunch of files. I've created a form to search for the files by various key words. After searching, the results are displayed in a listbox - coded in VBA. If I double click on a specific result, it opens the file's path (say a PDF document). I want to make it so that if I click just once on the specific result, it will show a little picture in the corner of the form. How would I go about coding this?

解决方案

Assuming that the path name is a url to a file or web site (or document on a web site), or some document on your local computer?

Assuming that the list box sql source is say 3 columns,

Id Description FullPathName

Likely in above, while the list box may well be based on 3 columns, you can hide the id and FullPathName of the query used to drive the list box.

Next up simply drop a web control in the upper corner and size it the way you want (a web control is ideal, since it will display picture, web sites, PDF, word documents and just about anything else your computer can render).

Then in the after update even of the list box, use this VBA code:

  Private Sub List0_AfterUpdate()

     Dim s       As String

     s = "=(" & """" & Me.List0.Column(2) & """" & ")"

     Me.WebBrowser2.ControlSource = s

  End Sub

这篇关于单击时在 Access 2013 列表框中显示小预览图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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