相关疑难解决方法(0)

使用路径从外部源将图像添加到表单中

我一直在 Google 上搜索以找到一种更好的方法来在 Access 中显示图像,而无需将图像实际插入数据库中。

我通过这个线程找到了这篇文章“ http://support.microsoft.com/kb/285820 ”“有没有办法获得 ms-access 以显示来自外部文件图像”,其中详细介绍了如何设置路径图片通过文件夹/文件,对于“设置”图片,它效果很好。但是,当我切换到不同的记录时,我希望显示不同的图片。

这是文章中的代码:

Option Compare Database
Option Explicit

Public Function DisplayImage(ctlImageControl As Control, strImagePath As Variant) As String
On Error GoTo Err_DisplayImage

Dim strResult As String
Dim strDatabasePath As String
Dim intSlashLocation As Integer

With ctlImageControl
    If IsNull(strImagePath) Then
        .Visible = False
        strResult = "No image name specified."
    Else
        If InStr(1, strImagePath, "\") = 0 Then
            ' Path is relative
            strDatabasePath = CurrentProject.FullName
            intSlashLocation = InStrRev(strDatabasePath, "\", Len(strDatabasePath)) …
Run Code Online (Sandbox Code Playgroud)

ms-access vba image ms-access-2010

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

image ×1

ms-access ×1

ms-access-2010 ×1

vba ×1