[AccessD] A simple Treeview to edit data.

David McAfee davidmcafee at gmail.com
Mon Mar 2 11:56:16 CST 2009


I keep getting Runtime Error -2147221164 (80040154) "Class not
registered" when I open the form or click on any node.

I looked at the references, and don't have anything missing.

I'm using Access 2003, SP3 on WinXP SP3. Any ideas what I may be doing wrong?
I have the latest jet 4.0 dll (4.0.9511.0).

It highlights the following line when it gives the error:

st.ID = CLng(strArray(1))  (located in :Private Sub tvwStates_NodeCheck)

References show the following:
VBA
MS Access 11 Object library
OLE automation
DAO 3.6 Object library
MDAC 2.1 library
MS Windows Common COntrols 6.0 (SP6)

David

On Mon, Mar 2, 2009 at 8:54 AM, Drew Wutka <DWUTKA at marlow.com> wrote:
> With the interest shown about treeviews, I decided to whip up another
> example this morning.
>
>
>
> As you all know, Access is an awesome RAD tool, that allows you to
> create very powerful interfaces.  When it comes to editing 'system'
> data, Treeviews will probably fall short.  But where they can really
> come in handy (and look pretty cool), is when it comes to editing
> 'default' data.
>
>
>
> As an example, I have whipped up states.mdb.
> http://www.marlow.com/states.zip
>
>
>
> To begin with, to deal with the actual data, I used my Data Class
> Builder (a VB addon I created a while back).  So the State and AllStates
> (wouldn't let me save the class name as States...go figure) are classes
> that were automatically generated by my Data Class Builder.  A quick and
> dirty example of data classes (and collection).
>
>
>
> Next, I noticed to actually get to the Treeview's custom dialog box (a
> window that let's you get to the Treeview's very flexible custom
> properties), when you go into the properties of your ActiveX Treeview
> control, go to the 'Other' Tab, and click the ... next to Custom.
>
>
>
> Now, after you download the example, take a quick look at tblStates.  An
> ID field, then an Abbreviation, FullName, and InUse fields.  I'm sure
> most of us have a table like this in one system or another (if not
> most).
>
>
>
> Let's give our Users a form to edit this information.  Check out
> frmStates.
>
>
>
> Keep in mind, this example database took me about 5 minutes to build.
> It's taking longer to write this email then to build this example.
> There a quirk that I noticed in testing.  One, if you run into a unique
> index issue, it errors, something that a little more code could handle.
> So just keep that in mind, that this is an example, not a full blown,
> ready to go into production system.
>
>
>
> When you open frmState, notice that all the records are listed.  (And
> everything is checked).  It lists all the states by full name.  If you
> expand a node, you get the state's abbreviation.  Uncheck either the
> fullname or the abbreviation, and both are unchecked, AND the 'InUse'
> flag for that state is now set to false in the table. (Or check an
> unchecked state, and the reverse happens)  Cool, eh?  But what if we
> want to rename a state.....
>
>
>
> Click on a state. (either the full name or it's abbreviation.  It
> becomes selected (highlighted).  Now click on it again.  (single
> clicks)....and the 'label' goes into Edit mode.  Type whatever you want
> in that label. (Keep in mind that both the fullname and abbreviation
> fields are unique indexes, so you can't make FLORIDA 'MAINE', it'll
> choke.  But you could rename florida to 'Can't Decide'. <grin>.  When
> you are done typing in what you want to rename the state too, just hit
> enter.  It goes out of edit mode....and the new data is saved to the
> appropriate field!  (Go check the table!).
>
>
>
> The InUse is handled by the NodeCheck event for the treeview, and the
> field renaming is handled by the AfterLabelEdit event.
>
>
>
> There is another really nice advantage to Treeviews, and I've added this
> to this example.  Sometimes you want the user to be able to resize a
> form.  And when you have lots of controls on a form, that's a lot of
> controls to resize.  With the 'all in one' ability of a treeview control
> (the ability to handle multiple purposes in the same control), you only
> have one control to resize!  Resize the frmStates form, and you'll see
> it only takes two lines of code to keep that form looking nice, neat,
> and uniform!
>
>
>
> Drew
>
>
> The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>




More information about the AccessD mailing list