Unbound images and attachments in AC2007

jan@BRU

Registered User.
Local time
Today, 07:08
Joined
Jul 18, 2007
Messages
39
Hello
I have the following problem and was wondering, whether anybody could help me with that.

I have a table, that has a unique identifier (ID) plus an image as an attachment (Access 2007).

What I now want to do is the following. ON a form, display the (say) 10 first images of the table on an unbound form, who's identifiers starts with "A" (or any other criteria).

Basically, I want to assign the "value" of an image to an unbound image control. I have been trying to follow the method described at the very end of the following page (book excerpt).
http://msdn.microsoft.com/en-us/library/dd548008.aspx
It's not entirely the same thing, but I thought that the idea was similar.

So what I have done, I have created an unbound form, and placed a number of (unbound) attachments on to it (they are named A1 ... A10) . I then create a recordset from the table, containing all records, where the identifier starts with "A" and that includes the identifier plus the Image. I than want to loop through the first 10 records and update the default picutre of the attachment with what's in the recordset's attachment... It just doesn't work. Can anyone spot the error or suggest a different method?

Dim att as attachment
Dim rs as dao.recordset
Dim i as long


Set rs = CurrentDb().OpenRecordset("SELECT ID, Icon FROM qSCH_MainConsolidated", dbOpenDynaset)

If Not rs.EOF Then rs.MoveFirst
For I = 1 To 18
If Not rs.EOF Then

Set att = Me.Controls("A" & I)
If Not IsNull(rs!Icon!Filename) Then
att.DefaultPicture = rs!Icon!Filename
End If
rs.Movenext
Else
Me("A" & I).Visible = false
End if
Next I
 
Hello,
I'm afraid, this doesn't work for me. The Attachment doesn't hava a 'picture' object. And for some reason,I can't find the right syntax to allocate not the 'filename' as such, but the 'picture' content to the attachment to displayed.
any help?

Thanks for the hint on the other method, but htis time, I really have to use attachments within the database.

many thanks

jan
 
Have you thought about using a subform and in that subform have one row of three or four columns of bound image controls? The main form (in which the subform will be embedded) will be based on the record source that has the unique ids of the images. Your subform's Default View property will be set as a Continuous Form. Edit the sql of the main form's record source to include the TOP statement, something like: SELECT TOP 10 [PictureID] .......
 
Have you thought about using a subform and in that subform have one row of three or four columns of bound image controls? The main form (in which the subform will be embedded) will be based on the record source that has the unique ids of the images. Your subform's Default View property will be set as a Continuous Form. Edit the sql of the main form's record source to include the TOP statement, something like: SELECT TOP 10 [PictureID] .......


thought about that, but for many reasons, it won't work for me, not the least of which being that I'm already on a subform.

Anybody knows, on how to get those unbound attachments to accept and display stuff, that's already elsewhere in the database?

many thanks
jan
 
Zip and attach your db, with a few images so the size is small.
 

Users who are viewing this thread

Back
Top Bottom