View Full Version : Forcing Intellisense to work in VBA


PaulV
01-12-2008, 04:21 PM
Hi all

It seems that some have trouble getting Intellisense to work when writing code for common controls.

The trick is to declare the objects at the beginning. For example working with a treeview control declare the treeview and nodes first eg

Dim objTVW As TreeView, objNode As Node

Declare and set your query strings and database objects next.

Then set the treeview object
Set objTVW = Me!YourTreeviewName.Object

Clear all treeview nodes
objTVW.Nodes.Clear

Set the node object and add the properties
Set objNode = objTVW.Nodes.Add([Relative], [Relationship], [Key], Text, [Image], [Selectedimage])

The Node syntax [bracketed] properties are optional, the Text is required for the node text.

Don't forget to destroy all objects at the end to free memory.
Set objNode = Nothing
Set objTVW = Nothing

Close and destroy database and recordsets
db.Close
Set db = Nothing
rst.Close
Set rst = Nothing


Paul