I have treeview node_click routine that is doing something that I dont get.

  • Thread starter kelly d via AccessMonster.com
  • Start date
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
 
K

kelly d via AccessMonster.com

I figured it out. I have no idea why, but the me.bookmark=rsO.bookmark has to
be the last thing the routine does. the bookmarking messes with my listbox
updating. So that mystery is solved but that leads me to my next mystery if
anybody has any idea, why does the 'me.bookmark=rsO.bookmark' affect it
working?

thanks.
 
A

Alex Dybenko

Hi,
perhaps you have some code in Form_Current event , which executed after
me.bookmark=rsO.bookmark, check what you have there
 
K

kelly d via AccessMonster.com

Thanks for the reply.
I didnt really have a use for a Form_Current event, but I did go back and
check to see if there was one there with code in it (I experiment with my
code alot and sometimes I forget to delete unneeded event routines) but not
this time. right now, the only form event I have is a Form_Load event but
that code wouldnt run after the bookmark changed would it?
thanks.

Alex said:
Hi,
perhaps you have some code in Form_Current event , which executed after
me.bookmark=rsO.bookmark, check what you have there
I figured it out. I have no idea why, but the me.bookmark=rsO.bookmark has
to
[quoted text clipped - 5 lines]
 
A

Alex Dybenko

Then I would try to recreate form from scratch, perhaps it get corrupted of
so.

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


kelly d via AccessMonster.com said:
Thanks for the reply.
I didnt really have a use for a Form_Current event, but I did go back and
check to see if there was one there with code in it (I experiment with my
code alot and sometimes I forget to delete unneeded event routines) but
not
this time. right now, the only form event I have is a Form_Load event but
that code wouldnt run after the bookmark changed would it?
thanks.

Alex said:
Hi,
perhaps you have some code in Form_Current event , which executed after
me.bookmark=rsO.bookmark, check what you have there
I figured it out. I have no idea why, but the me.bookmark=rsO.bookmark
has
to
[quoted text clipped - 5 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top