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
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