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 strPictureLoc As String
Set db = CurrentDb
Set rst = db.OpenRecordset("tblSysAdmin", dbOpenSnapshot)
strPictureLoc = rst!BackgroundGraphics
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
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 strPictureLoc As String
Set db = CurrentDb
Set rst = db.OpenRecordset("tblSysAdmin", dbOpenSnapshot)
strPictureLoc = rst!BackgroundGraphics
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