dcsimg
Results 1 to 6 of 6

Thread: putting pictures on a form and report in access

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2018
    Posts
    54

    putting pictures on a form and report in access

    Name:  Roll_1.jpg
Views: 76
Size:  4.8 KBName:  Roll_2.jpg
Views: 65
Size:  4.8 KBName:  Roll_3.jpg
Views: 72
Size:  4.9 KBName:  Roll_4.jpg
Views: 70
Size:  4.9 KB
    I have 8 of these images , i want to make a form that has a way for for someone to select one of the images on the form to save it to a record and then later on i need the image to be printed in a report along with all the records that go with the images.

    i tried using an OLE file type as a list for the field but ms access would not allow me to

    thanks

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Java (JSP) Hell!
    Posts
    5,294

    Re: putting pictures on a form and report in access

    image control + jpgs to shared area (or local drive) for display.
    event click to select... to a form variable... or field
    report might be a bit more difficult though

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2018
    Posts
    54

    Re: putting pictures on a form and report in access

    how would i go about doing "image control + jpgs to shared area (or local drive) for display."

    thanks for your answer

  4. #4

    Thread Starter
    Member
    Join Date
    Feb 2018
    Posts
    54

    Re: putting pictures on a form and report in access

    Name:  343.jpg
Views: 29
Size:  24.4 KB
    i have decided i may just want a drop down box like above picture, and have a image control linked to show up depending on what number is in the unwind field. if there is a one in the unwind field have this image pop up Name:  Roll_1.jpg
Views: 29
Size:  4.8 KB


    maybe something like this, but in VBA:
    case 1: getImage("img/img1.png");
    break;
    case 2: getImage("img/img2.png");
    break;
    default: getImage("img/default.png");
    Last edited by cubsm22p; May 7th, 2018 at 12:07 PM.

  5. #5
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,532

    Re: putting pictures on a form and report in access

    Likely not the best approach, but...

    I put a few images on a form, and have a table with only one column ("LastChosen"). The table is updated depending on which image is clicked like so:

    Code:
    Option Compare Database
    Dim str As String
    
    Sub insertValue(ByVal str As String)
        str = "INSERT INTO selections (LastChosen) VALUES ('" & str & "');"
        DoCmd.RunSQL str
    End Sub
    
    Private Sub Image1_Click()
        insertValue ("1")
    End Sub
    
    Private Sub Image2_Click()
        insertValue ("2")
    End Sub
    I would then, when necessary, read the last record in the table and process accordingly, ie. display image number 1 on the report if the last record has a value of "1," etc.

  6. #6

    Thread Starter
    Member
    Join Date
    Feb 2018
    Posts
    54

    Re: putting pictures on a form and report in access

    ok i have got a form for data entry almost figured out:
    Name:  6777.PNG
Views: 23
Size:  115.8 KB
    here is what my form looks like, i got the photo to change with the dropbox using this VBA code
    Code:
    Private Sub Combo75_AfterUpdate()
    Select Case Me.Combo75.Value
    Case "1"
    Me.Imagepath = "C:\Users\rr296749\Downloads\Roll_1.jpg"
    Case "2"
    Me.Imagepath = "C:\Users\rr296749\Downloads\Roll_2.jpg"
    Case "3"
    Me.Imagepath = "C:\Users\rr296749\Downloads\Roll_3.jpg"
    Case "4"
    Me.Imagepath = "C:\Users\rr296749\Downloads\Roll_4.jpg"
    Case "5"
    Me.Imagepath = "C:\Users\rr296749\Downloads\Roll_5.jpg"
    Case "6"
    Me.Imagepath = "C:\Users\rr296749\Downloads\Roll_6.jpg"
    Case "7"
    Me.Imagepath = "C:\Users\rr296749\Downloads\Roll_7.jpg"
    Case "8"
    Me.Imagepath = "C:\Users\rr296749\Downloads\Roll_8.jpg"
    End Select
    Me![ImageFrame].Picture = Nz(Me![Imagepath)
    End Sub
    the image shows the right image when i go and choose unwind from dropdown. but when im searching through the records using "next record" button is will not change the image to go with the unwind value.

    ive tried puting "Me![ImageFrame].Picture = Nz(Me![Imagepath)" in alost every event type in the form and get nothing. how would i get the image to change with the records

    ps. so far the only way i can get it to pop up when switching records is by putting "Me![ImageFrame].Picture = Nz(Me![Imagepath)" this in the image control event 'On Mouse Move'
    Last edited by cubsm22p; May 8th, 2018 at 01:37 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width