So I am using a file dialog to select a picture and display it for an item in our inventory.
This code comes from a test form, which works fine.
However, when i use this exact code in my production form, i get a type mismatch @
.
I've tried dimming the variables as variant, but that did not work either.
I've also deleted the code, removed the blank lines, compiled and reinserted the code.
Not sure what to check next.
Code:
Private Sub cmdBrowse_Click()
Dim strFile As String
Dim strName As String
strFile = ShowDialog
strName = strFile
Debug.Print strName
strName = Right(strFile, 10)
strName = Left(strName, 6)
Debug.Print strName
Me.imgPic.Picture = strFile
End Sub
This code comes from a test form, which works fine.
However, when i use this exact code in my production form, i get a type mismatch @
Code:
strName = Left(strName, 6)
I've tried dimming the variables as variant, but that did not work either.
I've also deleted the code, removed the blank lines, compiled and reinserted the code.
Not sure what to check next.