I have a table in SQL which is full of hyperlinks to pictures.
What i want to do is from within a access form, look up the picture on hyperlink address, then save the picture to a local drive,
The URL is transferred to the MyPic String with no issues, but i am struggling to save this as a Jpg file.
I do not get any errors, it just does not save.
Do i have to do this a different way ?
What i want to do is from within a access form, look up the picture on hyperlink address, then save the picture to a local drive,
The URL is transferred to the MyPic String with no issues, but i am struggling to save this as a Jpg file.
I do not get any errors, it just does not save.
Do i have to do this a different way ?
Code:
Sub GetPicture(CatNo As String)
On Error GoTo Handler
Dim PicPath As String
Dim sLocalFile As String
Dim MyPic As String
Call Open_Connection1(DB_Name1)
strsql = "SELECT [URL] FROM [dbo].[Image_URLs] WHERE [CATALOGUE_NUMBER] = '" & CatNo & "'"
Set rs = New ADODB.Recordset
rs.Open strsql, cnAWS, adOpenStatic 'runs the defined query
On Error Resume Next
MyPic = rs("URL")
Set rs = Nothing
Call Close_Connection
sLocalFile = Environ("Temp") & "\Pic.jpg"
SaveFile MyPic, PicPath
imgWeb.Picture = PicPath
DoEvents
Exit Sub