PDA

View Full Version : Picture Box issue



antrock101
02-15-2013, 05:35 PM
Hello,

I currently have a black image box in my form on access and i'm trying to code it so that it will find an image based on a variable. The code below comes up with an error run time 2220 -1509615163 can anyone see what i'm doing wrong?

Dim strPic As String
Dim strDatabasePath As String
strDatabasePath = CurrentProject.Path
Pic = strDatabasePath & "\images\" & Text2 & ".bmp"
Me.Image26.Picture = LoadPicture(Pic)

SoftwareMatt
02-22-2013, 03:54 AM
What is LoadPicture?

Try this:

Dim strPic As String
Dim strDatabasePath As String
strDatabasePath = CurrentProject.Path
strPic = strDatabasePath & "\images\" & Text2 & ".bmp"
Me.Image26.PictureType = 1
Me.Image26.Picture = strPic

NB: When are you running the code - I normally do it on the OnOpen of the form or OnCurrent.