Hello!
Hopefully this will make sense - I'll do my best to explain:
I have a form which displays song lyrics in the SongLyrics memo control. Within this form there is a listbox named SelectedSongs. Below the latter listbox, I have a checkbox whereby when I check it, it places the title of the song lyrics I am viewing into the SelectedSongs checkbox.
Here is the code to the checkbox which works just fine:
As you can see, it utilizes a table (SelectedSongT) to store the song titles which feeds the SelectedSongs listbox and when I uncheck the checkbox control it removes the song title(s).
Here's what I would like to do: Have command buttons that allow me to move the songs in the listbox up and down BUT this will also require that the songs also be re-arranged in the table which feeds the listbox - which is where I am having trouble.
I have tried several VBA approaches (now deleted) only to be met with an error from Access indicating - I'm paraphrasing, "This method requires the Row Source Type to be a 'Value List'"
Any guidance/help would be very much appreciated - thank you much!
José
Hopefully this will make sense - I'll do my best to explain:
I have a form which displays song lyrics in the SongLyrics memo control. Within this form there is a listbox named SelectedSongs. Below the latter listbox, I have a checkbox whereby when I check it, it places the title of the song lyrics I am viewing into the SelectedSongs checkbox.
Here is the code to the checkbox which works just fine:
Code:
If Me.Dirty Then Me.Dirty = False
Set dbs = CurrentDb
If PrintSong Then 'PrintSong is the name of the checkbox control.
DoCmd.SetWarnings False
Set rst = dbs.OpenRecordset("SelectedSongsT", dbOpenDynaset)
If Not rst.EOF Then rst.MoveLast
DoCmd.RunSQL "INSERT INTO SelectedSongsT ([PrintOrder], [SongTitle], [SongID]) VALUES (" & rst.RecordCount + 1 & "," & Chr(34) & Me.SongTitle & Chr(34) & "," & Me.SongID & ");"
Else
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE FROM SelectedSongsT WHERE [SongTitle]=" & Chr(34) & Me.SongTitle & Chr(34) & " AND [SongId]=" & Me.SongID
Set rst = dbs.OpenRecordset("SelectedSongsT", dbOpenDynaset)
If Not rst.EOF Then
Do
rst.Edit
rst![PrintOrder] = rst.AbsolutePosition + 1
rst.Update
rst.MoveNext
Loop Until rst.EOF
End If
End If
DoCmd.SetWarnings True
Me.SelectedSongs.Requery
Here's what I would like to do: Have command buttons that allow me to move the songs in the listbox up and down BUT this will also require that the songs also be re-arranged in the table which feeds the listbox - which is where I am having trouble.
I have tried several VBA approaches (now deleted) only to be met with an error from Access indicating - I'm paraphrasing, "This method requires the Row Source Type to be a 'Value List'"
Any guidance/help would be very much appreciated - thank you much!
José