johnkrytus
Registered User.
- Local time
- Today, 13:54
- Joined
- Mar 7, 2013
- Messages
- 91
I have a picture stored on a network file share that populates each time a particular form is opened. Every so often we lose our connection (which is a different issue altogether). Right now the error I get after much grinding away, is "Bad file name or number"
Is there a quicker way to check for the connection before it spends 45 seconds trying to find the whole path?
Is there a quicker way to check for the connection before it spends 45 seconds trying to find the whole path?
Code:
Dim vFolderPath As String, dirFile As String, strFile As String
vFolderPath = Nz(DLookup("FolderName", "tblCodes-FolderControl", "FolderKey = '" & "Profile" & "'"))
dirFile = vFolderPath & Dir(vFolderPath & ctrl_people_id & " *", vbDirectory)
strFile = dirFile & "\profile_pic.*"
'Debug.Print dirFile
On Error Resume Next
If Dir(strFile) <> vbNullString Then
Me.[ctrl_ImageFrame].Picture = dirFile & "\" & Dir(strFile)
Else
Me!ctrl_ImageFrame.Picture = "X:\~stuff\profile_icon.png"
End If