These one word answers aren't any help. I read post 17 several times but it didn't really explain or tell me anything that I could understand. I was more mystified after reading it than before. But he also said he didn't understand what I was doing. I did try to put the question as best I could, Anyway it's working fine, but it's always interesting and often worthwhile to see other, possibly better methods. If I'm doing something wrong I'd like to correct it.
Anyway it's working fine, but it's always interesting and often worthwhile to see other, possibly better methods. If I'm doing something wrong I'd like to correct it.
How about posting a copy of the database or some graphics of "what is working fine"? How would we know if anything is wrong or what to correct without seeing your requirement and your current solution?
Fair enough But I don't know how much detail you want. My question in Msg#1 says it all and code is in Msg #12.
There's a global array of jpg filenames (called Images) to pass them, via the navigation buttons, to the Form as Me. Picture.
Seems navigation buttons won't work unless the Form is bound. So I make a table from the array, Set the Forms Record Source to it and Open it. Dim r As DAO.Recordset, i As Integer
DoCmd.SetWarnings False
DoCmd.RunSQL ("Delete * From tblPics")
DoCmd.SetWarnings True
Set r = CurrentDb.OpenRecordset("tblPics")
For i = 1 To UBound(Images)
r.AddNew
r(0) = Images(i)
r.Update
Next
DoCmd.OpenForm "frmPic", acNormal, , , , acWindowNormal
Set r = Nothing
Code:
Private Sub Form_Current()
Me.Picture = Images(Me.CurrentRecord)
Me.Caption = StripPath(Images(Me.CurrentRecord))
End Sub
Maybe what is being suggested is as there's now a table bound to the Form containing the data should come from that and not the array. What stopped me was how to set Me.Picture to the current record as I don't have a name for it, only it's index number. Perhaps a recordset and use rx(me.CurrentRecord). But that seemed even more contrived. There's already an array waiting to be used.
So that's the whole deal.
The attached database is used to display thumbnail images for selected images in a folder. Click the Populate Image List button then select a folder containing images. This will add the names of all images in the folder to the listbox. As an option, you can choose whether to include images in...