X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Image Controls "picture" Property Length Limit, Access 2013    
post Feb 26 2020, 05:43 PM

Posts: 32
Joined: 2-December 17

hi, I'm trying to display an image in an image control but i just got an error when trying to assign an image that has a long path.
I looked up the image.picture property on google and couldn't find the length limit.

Anyone know what it is?
Anyone have suggestions of how to get around this issue?


In this particular instance, I'm temporarily displaying the image via it's location the user browsed to, as a confirmation before copying it to a system directory.
I know the path length for the system directory is within (whatever the limit is) because i haven't had issues yet. So i SUPPOSE, i could temporarily copy the browsed image to a temp directory that has a known shorter path length, but i'd like to avoid this if possible.

this may be the limit: http://www.avantixlearning.ca/microsoft-ac...ourse-resource/
"field property setting" limit is 255, ImageControl.Picture is considered such.
This post has been edited by slacka: Feb 26 2020, 05:51 PM
Go to the top of the page
post Feb 26 2020, 07:44 PM

UtterAccess VIP
Posts: 7,247
Joined: 30-June 11

I did a quick test and it seems to accept a path/filename up to 255 characters long. The minute I exceeded that I received Error 2176 - The setting for this property is too long.

One workaround that seems to work (in my limited testing) would be to use the ShortPath using, something like:

Private Declare Function GetShortPathName Lib "kernel32" _
   Alias "GetShortPathNameA" (ByVal lpszLongPath As String, _
   ByVal lpszShortPath As String, ByVal cchBuffer As Long) _
   As Long

Sub YourSub()
    Dim sBuffer             As String * 255
    Dim lReturnCode         As Long

    sFile ="YourPathAndFileName"
    lReturnCode = GetShortPathName(sFile, sBuffer, 255)
    sShortPath = Left$(sBuffer, lReturnCode)

    Me.YourImageControlName = sShortPath

End Sub

Daniel Pineault (2010-2019 Microsoft MVP, UA VIP, EE Distinguished Expert 2018)
Professional Help: https://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: https://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc

All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    31st March 2020 - 09:02 AM