Using Record Selectors (1 Viewer)

Yes, data must be in a table. Then a form can be bound to table or query or have an SQL statement in RecordSource. Not an array.
 
Seeing I have an array though (and create a table from it) then what I'm doing is as good a method as any ?
 
Seeing I have an array though (and create a table from it) then what I'm doing is as good a method as any ?
No.
 
See post #17.

Why would you want to employ less efficient method?
 
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.
 
Have a look at a different approach which works well and involves no arrays.
 

Users who are viewing this thread

Back
Top Bottom