By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,461 Members | 2,184 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,461 IT Pros & Developers. It's quick & easy.

Test for Nothing

P: n/a
How can I test (in VBA code) if an object is set to Nothing.
Specifically, I'm trying to check whether I've yet saved a node from a
treeview control so that I can remember where I've been in code to
change the selected node when a node is collapsed?

At present, the relevant bits of my code are:

Option Compare Database
Option Explicit

Dim nodPrevious As Node

-----------------------
Private Sub tvwWP_NodeClick(ByVal Node As Object)
Dim ...

'Save this node for collapse
Set nodPrevious = Node

'Filter Risks by the selected node on the form
....
End Sub
------------------------
Private Sub tvwWP_Collapse(ByVal Node As Object)
Dim ...

If Not nodPrevious = Nothing Then '*** THIS IS WHERE I NEED TEST
...
End If
End Sub
------------------------

My problem arises because it's possible to expand and collapse the
tree without clicking on a node (or, more specifically, using the +/-
symbols does not trigger the NodeClick event).

BTW, if anyone can recommend a good tutorial on using treeview
controls in Access, I'd really appreciate it. I've found a couple,
but they seem to focus mostly on populating the control from code;
I've found nothing really helpful about subsequent manipulation, or
useful events, or ...

TIA,

Rob
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On 24 Aug 2004 17:59:22 -0700, ro***********@dsto.defence.gov.au (Rob
Parker) wrote:

If Not nodPrevious Is Nothing Then
-Tom.

How can I test (in VBA code) if an object is set to Nothing.
Specifically, I'm trying to check whether I've yet saved a node from a
treeview control so that I can remember where I've been in code to
change the selected node when a node is collapsed?

At present, the relevant bits of my code are:

Option Compare Database
Option Explicit

Dim nodPrevious As Node

-----------------------
Private Sub tvwWP_NodeClick(ByVal Node As Object)
Dim ...

'Save this node for collapse
Set nodPrevious = Node

'Filter Risks by the selected node on the form
...
End Sub
------------------------
Private Sub tvwWP_Collapse(ByVal Node As Object)
Dim ...

If Not nodPrevious = Nothing Then '*** THIS IS WHERE I NEED TEST
...
End If
End Sub
------------------------

My problem arises because it's possible to expand and collapse the
tree without clicking on a node (or, more specifically, using the +/-
symbols does not trigger the NodeClick event).

BTW, if anyone can recommend a good tutorial on using treeview
controls in Access, I'd really appreciate it. I've found a couple,
but they seem to focus mostly on populating the control from code;
I've found nothing really helpful about subsequent manipulation, or
useful events, or ...

TIA,

Rob


Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.