Results 1 to 4 of 4

Thread: Recovering an image from an access database

  1. #1

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    Set the image boxes datasource and datafield to the datacontrol your using in vb!

    Be back to give example! soon

  2. #2

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    OK Example:

    Private Sub Form_Load()

    Set cn = New ADODB.Connection
    cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;" & _
    "Data Source= DATABASE NAME HERE"
    cn.Open


    Set rs = New ADODB.Recordset
    rs.Open "TABLE NAME HERE", cn, adOpenKeyset, adLockPessimistic, adCmdTable


    PopulateFields
    end sub

    Public Sub PopulateFields()
    If Not (rs.BOF And rs.EOF) Then
    txtDescription.Text = rs.Fields("Description")
    Set Image1.DataSource = rs
    Image1.DataField = "Picture"
    End If
    End Sub

    hope it helps!

  3. #3
    Brian
    Guest
    I get this error message:

    Unable to bind to field or datamember: 'FIELD NAME'

    what's lacking?

    Thanks dude!

  4. #4

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    In this:

    Public Sub PopulateFields()
    If Not (rs.BOF And rs.EOF) Then
    txtDescription.Text = rs.Fields("DB FIELD NAME") 'this is not needed i have it in mine for a description of the pic!
    Set Image1.DataSource = rs
    Image1.DataField = "DB OLE FIELD NAME"
    End If
    End Sub

    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