Display random background pics on form loading?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
 
Back
Top