K
kelly d via AccessMonster.com
I have a treeview that lists all the dvds in my collection, I have a listbox
that lists all possible genres that a movie can be, I have a treeview
nodeclick routine that does a basic .findfirst on the movie that was clicked
in the treeview which proceeds to convert the genre field value into an array
using the split function and uses that array to highlight in my genres
listbox all the genres that particular movie actually is. Everything works
fine with finding a movie, I click a movie in the treeview, the .findfirst
works, that movies details comes up in my form. even the listbox routine
works to highlight the genres of that movie, but the part I cant figure why
is happening, I have to click a movie twice (not double-click, just click
once, movie comes up, click twice genre listbox highlights) on the same movie
to make my genre listbox do its highlighting thing. would somebody be kind
enough to look at my code and tell me if they see whats causing me to have to
click twice on the same movie before my listbox peice of code will run?
thanks. (P.S. ListOfMovies is my treeview, and GenreList is my listbox, genre
is my table field and I have rsO dimmed as public).
Private Sub ListOfMovies_NodeClick(ByVal Node As Object)
If Node.Image <> "Movie" Then Exit Sub
Set rsO = Me.Recordset.Clone
rsO.FindFirst "name ='" & Node.Text & "'"
Me.Bookmark = rsO.Bookmark
thepicture.picture = rsO!picture
If Me!Loanedout = True Then
WhoWhen = rsO!Who & ", " & rsO!When & ", " & DateDiff("d", Me!When, Date)
& " Days."
' Debug.Print DateDiff("d", rsO!When, Date)
Else
WhoWhen = ""
End If
NodeLocation = Node.Index + 1
'--------------------------------
TheGenre = rsO!genre
For z = 0 To GenreList.ListCount - 1
GenreList.Selected(z) = False
Next
'Debug.Print TheGenre
allgenres = Split(TheGenre, ", ")
Debug.Print rsO!genre, TheGenre, GenreList.ListCount, UBound(allgenres)
For y = 0 To GenreList.ListCount - 1
For x = 0 To UBound(allgenres)
'Debug.Print allgenres(x), GenreList.ItemData(y);
If allgenres(x) = GenreList.ItemData(y) Then
'Debug.Print " match"
Me!GenreList.Selected(y) = True
End If
Next x
Next y
End Sub
that lists all possible genres that a movie can be, I have a treeview
nodeclick routine that does a basic .findfirst on the movie that was clicked
in the treeview which proceeds to convert the genre field value into an array
using the split function and uses that array to highlight in my genres
listbox all the genres that particular movie actually is. Everything works
fine with finding a movie, I click a movie in the treeview, the .findfirst
works, that movies details comes up in my form. even the listbox routine
works to highlight the genres of that movie, but the part I cant figure why
is happening, I have to click a movie twice (not double-click, just click
once, movie comes up, click twice genre listbox highlights) on the same movie
to make my genre listbox do its highlighting thing. would somebody be kind
enough to look at my code and tell me if they see whats causing me to have to
click twice on the same movie before my listbox peice of code will run?
thanks. (P.S. ListOfMovies is my treeview, and GenreList is my listbox, genre
is my table field and I have rsO dimmed as public).
Private Sub ListOfMovies_NodeClick(ByVal Node As Object)
If Node.Image <> "Movie" Then Exit Sub
Set rsO = Me.Recordset.Clone
rsO.FindFirst "name ='" & Node.Text & "'"
Me.Bookmark = rsO.Bookmark
thepicture.picture = rsO!picture
If Me!Loanedout = True Then
WhoWhen = rsO!Who & ", " & rsO!When & ", " & DateDiff("d", Me!When, Date)
& " Days."
' Debug.Print DateDiff("d", rsO!When, Date)
Else
WhoWhen = ""
End If
NodeLocation = Node.Index + 1
'--------------------------------
TheGenre = rsO!genre
For z = 0 To GenreList.ListCount - 1
GenreList.Selected(z) = False
Next
'Debug.Print TheGenre
allgenres = Split(TheGenre, ", ")
Debug.Print rsO!genre, TheGenre, GenreList.ListCount, UBound(allgenres)
For y = 0 To GenreList.ListCount - 1
For x = 0 To UBound(allgenres)
'Debug.Print allgenres(x), GenreList.ItemData(y);
If allgenres(x) = GenreList.ItemData(y) Then
'Debug.Print " match"
Me!GenreList.Selected(y) = True
End If
Next x
Next y
End Sub