Results 1 to 4 of 4

Thread: How to retrieve picture from MS access

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    19
    I know how to retrieve words from MS access but what about pictures. E.g

    Private Sub Command1_Click()
    sName = Combo1.Text
    Set RS = DB.OpenRecordset("SELECT * FROM tblmachine WHERE MachineName = '" & sName & "'", dbOpenDynaset)
    Combo1 = "" & RS!MachineName
    Text2 = "" & RS!MaxPower
    Picture1 = ????
    RS.Close
    Combo1.SetFocus
    end if
    End Sub

    What do i type in for picture1 in order to retrieve different picture of items from a table in MS access?

    Thanks for the help!
    God bless
    Nigel
    [email protected]

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539

    Talking idea

    personally i would never store pictures right into the ACCESS DB for many different reasons... i can go on about them... but i wont

    why dont you make a directory where the database is and calle it Pictures...

    and in a table have a field called PicturePath
    and load the pictures throu a table but getting it from the picture directory

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    19
    Can you show me some example on it? Like how should i name my field for picturepath - OLE or Text or what even.
    And for the command line in my VB program, do i still name it - picture1 = RS! photo

    Please advice.
    God bless
    Nigel
    [email protected]

  4. #4
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539

    Talking hope this helps

    gonna try to make this short n sweet (expect 2 pages)
    we got a table called "Pictures"
    in that table, we have a field called "PicPath" (set that to text) and a field called PicID (set that to autonumber)
    in the same direcotry your .exe will be in
    we have a DIRECOTRY called "Pictures" and all your photos in that direcotry
    let say we have picture1.jpg, picture2.jpg ect
    in the PICTURE TABLE, in the picpath field
    we have "/picture1.jpg", "/picture2.jpg" as 2 records

    now we want to display one of those pictures
    let say we want to display first pic (and its ID should be 1)
    so lets make sql
    Code:
    SQL = "SELECT * FROM Pictures WHERE PicID = 1"
    set rs = db.openrecordset(sql)
    'checking if there is a pic with that id
    
    if not rs.eof then
        'picture1 being a image control
        picture1.picture = LoadPicture(app.path & rs!PicPath)
    end if
    if you have any questions let me know


Posting Permissions

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



Click Here to Expand Forum to Full Width