Show Small Preview Picture in Access 2013 List Box On Click

我的梦境 提交于 2020-07-24 04:26:28

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/32573419/show-small-preview-picture-in-access-2013-list-box-on-click

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!