Display random background pics on form loading?

M

Maarkr

That's a new one to me... I was asked to do this... I put the pics in one
directory, tried to mess with On_Load event, Form.picture = "Path", but
nothing (do I need UNC path?)... any help with this?
 
M

Maarkr

Maarkr said:
That's a new one to me... I was asked to do this... I put the pics in one
directory, tried to mess with On_Load event, Form.picture = "Path", but
nothing (do I need UNC path?)... any help with this?

Figured this out... What I did was this... made a table (PicTable) with 2
fields (PicID, PicPath) and put the paths in the picpath field... made a form
with an image control named image0... formatted appropriately... put this
code in... works good.

Private Sub Form_Load()

Dim strPic As String

strPic = CurrentDb.OpenRecordset("Select TOP 1 PicTable.PicPath FROM
PicTable ORDER BY Rnd([PicID])").Fields(0).Value

Debug.Print strPic

Me.Image0.Picture = strPic

End Sub
 

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