G
Gina Whipp
Hi All,
I inherited a database which I am fixing (like field names) but my main
problem is... The code works but you HAVE to store the image in .bmp
format. What I would like is whether the picture is '.jpg' or '.png' or
'.bmp' for it to be able to show. How do I code a dynamin? file extension?
I am at a loss.
Thanks for any and all help!
****CODE START****
imgSketch.Picture = ""
Dim PicPath, PNum, FormNum As String
Dim Length As Integer
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
'rtw 2.7.2006 rem out this Exit Sub not working
'If IsNull(PNum = Text558.Value) Then
'Exit Sub
'Else
PNum = Text558.Value
'End If
If Not IsNull(Combo573.Value) Then
FormNum = Combo573.Value
End If
'Use the ADO connection that Access uses
Set cn = CurrentProject.AccessConnection
'Create an instance of the ADO Recordset class, and set its properties
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = cn
.Source = "SELECT tblPath.Path FROM tblPath"
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.Open
End With
Length = Len(rs("Path"))
If Mid(rs("Path"), Length - 1, 1) = "/" Then
PicPath = rs("Path") & PNum & FormNum & "-1.bmp"
Else
PicPath = rs("Path") & "\" & PNum & FormNum & "-1.bmp"
End If
On Error Resume Next
imgSketch.Picture = PicPath
Set rs = Nothing
Set cn = Nothing
End Sub
****CODE END****
I inherited a database which I am fixing (like field names) but my main
problem is... The code works but you HAVE to store the image in .bmp
format. What I would like is whether the picture is '.jpg' or '.png' or
'.bmp' for it to be able to show. How do I code a dynamin? file extension?
I am at a loss.
Thanks for any and all help!
****CODE START****
imgSketch.Picture = ""
Dim PicPath, PNum, FormNum As String
Dim Length As Integer
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
'rtw 2.7.2006 rem out this Exit Sub not working
'If IsNull(PNum = Text558.Value) Then
'Exit Sub
'Else
PNum = Text558.Value
'End If
If Not IsNull(Combo573.Value) Then
FormNum = Combo573.Value
End If
'Use the ADO connection that Access uses
Set cn = CurrentProject.AccessConnection
'Create an instance of the ADO Recordset class, and set its properties
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = cn
.Source = "SELECT tblPath.Path FROM tblPath"
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.Open
End With
Length = Len(rs("Path"))
If Mid(rs("Path"), Length - 1, 1) = "/" Then
PicPath = rs("Path") & PNum & FormNum & "-1.bmp"
Else
PicPath = rs("Path") & "\" & PNum & FormNum & "-1.bmp"
End If
On Error Resume Next
imgSketch.Picture = PicPath
Set rs = Nothing
Set cn = Nothing
End Sub
****CODE END****