Using DAO to read a hyperlink address

C

cseifferly

I store graphics as hyperlinks in my database. These graphics are the
backgrounds, icons, etc. for certain forms. I am trying to develop a module
that can be passed the control name (form or image box) and set the picture
properties on open.

I have this so far:

'*************************************
Public Sub ApplyGraphics(frm As Form)

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strRaw, strPictureLoc As String
Dim intLen As Integer

Set db = CurrentDb
Set rst = db.OpenRecordset("tblSysAdmin", dbOpenSnapshot)

strPictureLoc = rst!BackgroundGraphics

'strRaw = rst!BackgroundGraphics
'intLen = Len(strRaw)
'strPictureLoc = Mid(strRaw, 5, intLen - 5)

rst.Close
Set rst = Nothing
db.Close
Set db = Nothing

frm.Picture = strPictureLoc
frm.PictureType = 1
frm.PictureSizeMode = 3
frm.PictureTiling = True
frm.Repaint

End Sub
'*******************************

I'm calling it like this:

Dim Temp As Form
Set Temp = Me.Form
Call modApplyGraphics.ApplyGraphics(Temp)

on the OnOpen Event.

This gives me an error "can't open the file #'I:\Bid
Administration\Graphics\light.bmp"'

Am I not formatting the string correctly? I know when you read a textbox
that has a hyperlink, you need to include "Hyperlink.Address" in the code but
I'm not sure how to handle this when I'm working with the string from a
recordset.

Also, currently this procedure is set up to only handle forms. How would I
expand it to image controls?

Any help would be great.
Crystal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top