Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Picture in my report 34

Status
Not open for further replies.

strantheman

Programmer
Mar 12, 2001
333
US
Ive searched all of the Access forums, and I haven't found a solution that works. This seems like a very common procedure so im sure someone out there can help.

My ITEM table looks like this:

name | imagepath
-----------------------------------------------
Linksys Cable/DSL Router | d:\lsBEFSR41.jpg
Netgear Switch | d:\ngFS105.jpg

Name is the name of the product, and imagepath is where the photo is stored on my drive. My report pulls NAME, IMAGEPATH from ITEM table for the specified ID. I want to show the name of the product, and its corresponding picture on my report.

For this discussion, lets say the two objects on my report are named itemName and itemImage. I would assume this is as simple as setting some property of itemImage to the IMAGEPATH field, but ive been unable to figure this out. Please provide any help that you can. Id be willing to receive an email with a sample MDB file if thats what I have to do.

thanks in advance, im really hurtin here.
 
Finally got it! It was the COMDLG32.OCX that was missing.

I installed and registered it and everything works wonderfully.

Thank you so very much!

:D

jacque

Just knowlegeable enough to cause problems.
 
Thanks to all who have contributed . . . it's a great thread. I have a related question that relates all the way back to the beginning of this thread.

I am using a continuous form that displays (for example 5 records) each with it's own picture. In the form's OnCurrent event I have the now infamous "Me![ImageFrame].Picture = Me![Path]" syntax (slightly different). Unlike a REPORT, a form does not have an OnFormat Event so the solution to each record having the correct associated picture won't work exactly the way it does for a report. With 5 records being displayed, all 5 pictures are the same and all 5 change depending on the Current Record. I can solve this by putting the image in the Header or Footer but would like to figure out a way that each record on the continuous form can simultaneously display the correct image.

Any help on this? Thanks in advance . . . :)

Dave
 
Dave, hello. I haven't tried what you are requesting yet but I will try to get something working and post back tomorrow.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Finally! I get to go to someone elses help rather than ask for it.

I had the same problem and this is what I was told to do. (Works wonderfully)

In the form properties change the OnCurrent event to
Code:
Private Sub Form_Current()
Dim I
On Error Resume Next
' Me![imageframe].Picture = Me![imagepath]
I = setImagePath()
I = setImagePath1()
I = setImagePath2()
End Sub

Remove any other proceedures that occur in the form properties.


Behind your second command button put the following code (change the number as necessary. 3 or 4 or whatever)

Code:
Private Sub BtnAssignImage2_Click()
DlgFilePath.ShowOpen
    Me!imagepath2 = DlgFilePath.FileName
    If Len(Me.imagepath2) > 0 Then
        Me.imageframe2.Picture = Me.imagepath2
    End If
End Sub

I'm at work and have the thread number at home. I post it tomorrow.



Just knowlegeable enough to cause problems.
 
Jacque427:

Thanks for the reply. This code seems as though it will work under certain conditions but, I'm not sure it will work with my current situation: In my database, it is functioning as an electronic catalog. The User can "browse" deeper into the catalog by selecting a category on a ListBox:

For Each varItem In List15.ItemsSelected
DoCmd.OpenForm "Select_Groups", , , "[CTGRY_ID] = " & List15.Column(0) & ""
Next varItem

The next form in the "drill-down" is opened based on the category the User selects. For example, if the User selects a category of "Pens" the next form opens and displays the various types of Pens we sell. The point here is that (unlike your example code) I don't use a "2nd Command Button"; the form recordset is created upon opening the form based on the selection from the ListBox on the previous form.

I like your code example though, I wonder if I can modify it somehow to work with my application??

P.S. It looks like you have a line of code commented out on your OnCurrent procedure:

' Me![imageframe].Picture = Me![imagepath]

Do you know a way to modify this code so as not to have to click a Command Button to update the images?

Thanks,

[rockband]

DavetheDrummer


 
I have a problem kinda along the same lines.
I have a report based on a query. The user enters a part number, and the report is simply a picture of the part (This is working grand now). However I now need to add and extra feature.

Some details first:
Pictures are stored in folder
c:\picswith a folder for each part. Within each folder is pictures of the part.
c:\pics\abc1\abc1.tif
c:\pics\abc1\abc2.tif

I need access to go into the folder (part no) entered by the user and pull back all the pictures there (up to 10), and place them on the report.

Any ideas?

Thanks in advance.

Paddya
 
Try this method. Create 10 image controls in 2 rows of 5. Set their Height property to 0 and their type, mode, alignment to embedded, stretch, centered. You will have to play with the appropriate width height settings to have the pictures look right.

Now for each record you can load of the .Picture property with the path and imagename starting at image1. Also, as you do this for each image then reset the height property to the predetermined height. Remember that this property has to be set in twips(1/1440 of an inch). As you do this if you have three images only the three images will show. After you move past the 5th image you should move images 5-10 down to a predetermined location on the report and reset the height of the detail section to accommodate this new lines of images. Now continue with loading up the images and reseting the height property.

I haven't actually tested this out but it should work with a little tweaking. If you need actual help with the code I can give you a hand there also.

Post back with questions.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Bob Scriver:

Were you able to look at the "DaveTheDrummer" post above in regards to showing multiple photos (simultaneously) on a continuous form? :)

Thanks,


DaveTheDrummer
[Rockband]
 
Yes, I took a look and couldn't get it to work. Was waiting for the thread# to be posted as promised.

Seems like there is a call to a function called:

setImagepath()

Seems like there is some code missing here. Don't understand this process yet. Maybe when he posts back with more info.


[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Thanks Bob,

Will wait on jacque427 to post the Thread #.



DaveTheDrummer
[Rockband]
 
Sorry, my mistake. The post was in a different forum, but here is the meat of the matter.

First, open the form design, choose the FORM item, then Properties. Now delete any references of "=setImagePath()"

Next, configure the On_Current to call the procedure you have in the system.

Modify the procedure to:

Code:
Private Sub Form_Current()
Dim I
On Error Resume Next
' Me![imageframe].Picture = Me![imagepath]
I = setImagePath()
I = setImagePath1()
I = setImagePath2()
End Sub

Not sure it will work for his application though.

jacque

Just knowlegeable enough to cause problems.
 
Jacque:

How 'bout the code for "setImagePath()"

Do you have it?

Dave :)


DaveTheDrummer
[Rockband]
 
Sure, here you go. You'll have to modify the picture path for a default picture.

Code:
Function setImagePath()
On Error GoTo PictureNotAvailable
    Dim strImagePath As String
    If Len(Me.imagepath) > 0 Then
        strImagePath = Me.imagepath
        Me.imageframe.Picture = strImagePath
    Else
        'display/assign the default nophoto.jpg
        Me.imageframe.Picture = "m:\security\trespassers\nophoto.jpg"
    End If
    Exit Function
    
PictureNotAvailable:
    On Error Resume Next
    Me.imageframe.Picture = "m:\security\trespassers\nophoto.jpg"
End Function

Just knowlegeable enough to cause problems.
 
Jacque:

I must be missing something here . . . or there is some missing code . . ?? I don't see how this code does anything at all . . . ??

Private Sub Form_Current()
Dim I
On Error Resume Next
' Me![imageframe].Picture = Me![imagepath]
I = setImagePath()
I = setImagePath1()
I = setImagePath2()
End Sub

Can you shed some light??

Thanks

DaveTheDrummer
[Rockband]
 
I'd be happy to e-mail you the form so you can see how it works.

I don't think I'd be able to explain it very well.

 
Dave, please see my profile and send me a copy if you would.

Thank you.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Jacque,

Check my profile (for E-mail address) and send me the form if you don't mind.

Thanks,

DaveTheDrummer
[Rockband]
 
Bob, did you mean Jacque?



Just knowlegeable enough to cause problems.
 
Yes, Jacque, I misspoke myself. Please send me a copy also.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Both of ya'll will have to change the location of the default photo, but it works pretty well.

j




Just knowlegeable enough to cause problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top