MS Access Forum / ActiveX Controls / November 2006
TreeCtrl / TreeView / TabControl / Node Tags
|
|
Thread rating:  |
Endré - 10 Nov 2006 12:50 GMT I have a form in MSAccess developed in VBA with an ActiveX Treeview control on the left and a Tab Control on the right. (Trying to mimic MSOutlook or something like that). Splitter controls are very difficult in VBA so that is why I have a Tab control for different pages. On the different TabControl Pages I have various SubForms, an ActiveX control linked to Visio diagrams, and 2 more ActiveX TreeCtrl for attachments and testing functions.
For what appears randomly, and for no apparent reason, I get the pop-up box "Microsoft Office Access has encountered a problem and needs to close. We are sorry for the inconvenience.....Please tell Microsoft about this problem." I can be using the front-end, moving around the controls, entering data, inserting nodes etc, and suddenly this pops up.
All my code has error trapping, and no errors get trapped before I receive this message. I am willing to eMail my code / mde / mdb files to anyone willing to help.
This happens regularly, but apparently inconsistently (to me) and I am wanting to distribute this application at some point. Has anyone experienced this before? I am developing this in VBA / MSAccess, and not .NET. I have written extensive .NET application development, but would prefer to keep this in the MSAccess environment.
Lastly : Tag arrays for nodes on treecontrols. Why can't I modify a tag array value set to a node. I have to pass the tag array to a string array, modify the string array, then set the node tag back to the string array!!!
 Signature Kind Regards,
Endré
Alex Dybenko - 10 Nov 2006 13:20 GMT Hi, first question - could be several reasons for this, I would try to comment out code, which do something with activex controls, to find out what piece cause this error. and do not place activex control on tab control pages - place them on a form "above" tab control and make them visible when certain tab selected
 Signature Best regards, ___________ Alex Dybenko (MVP) http://alexdyb.blogspot.com http://www.PointLtd.com
>I have a form in MSAccess developed in VBA with an ActiveX Treeview control > on the left and a Tab Control on the right. (Trying to mimic MSOutlook or [quoted text clipped - 31 lines] > array, > modify the string array, then set the node tag back to the string array!!! Endré - 14 Nov 2006 11:11 GMT Hi Alex, I tried the option of removing my ActiveX controls and placing them on the main form. Fortunately my object references do not need to be altered as they do not refer to the TabCtrl. I also remove the TabCtrl completely as there is no easy event code that refers to "on click of tab page", and replaced with with CmdButtons. ActiveX controls are now made visible true/false as required depending on CmdButton clicked.
At first it worked wonderfully well. I got no errors for about 20 minutes, everything that may have previously kicked me out of the application worked just fine. Then, for what seemed no reason it has started all over again....."Microsoft Office Access has encountered a problem and needs to close. We are sorry for the inconvenience ....."
I will start cleaning out my code to try to find exactly what is causing the problem. If you have any more good advice (that works for longer than 20 minutes !!!!!) please let me know,
 Signature Kind Regards,
Endré
> Hi, > first question - could be several reasons for this, I would try to comment [quoted text clipped - 38 lines] > > array, > > modify the string array, then set the node tag back to the string array!!! Alex Dybenko - 14 Nov 2006 11:58 GMT Hi Endré, I don't have any better advice then to find code which cause this crash. Unfortunately Access is not so stable with classes and activex controls, so you have to code carefully
 Signature Best regards, ___________ Alex Dybenko (MVP) http://alexdyb.blogspot.com http://www.PointLtd.com
> Hi Alex, I tried the option of removing my ActiveX controls and placing > them [quoted text clipped - 77 lines] >> > modify the string array, then set the node tag back to the string >> > array!!! Endré - 14 Nov 2006 12:27 GMT Thanks Alex. For your interest, and anyone else in dealing with recursive boms, nodes etc:
I only load my node structures one level at a time. Each node that gets added, also tests to see if there may be nodes below it, but only at the next level below and no further. If there should be child nodes at the next level, then I simply add a single dummy child node so that the + sign appears. You can do this by returning a data set of the required table using an outer join to the table below it. Group the data and use CountOfTablebelowfield to test if there should be child nodes.
If MDLSset!CountOfChild > 0 Then Set nodCurrent = objTree.Nodes.Add(nodCurrent, tvwChild, , "Dummy") End If
Then, on the event for node expanding, I delete the single dummy node, populate with the "real" next nodes and check once again for child nodes below them adding a dummy again if required. And so it goes on....
objTree.Nodes.Remove currNode.Child.Index Set MDLSset= CurrentDb.OpenRecordset("SELECT SSTH.STID, SSTH.STDSC, Count(SSTD.SDSQ) AS CountOfSDSQ..... Set nodCurrent = objTree.Nodes.Add(currNode, tvwChild, , strText) If MDLSset!CountOfSDSQ > 0 Then Set nodCurrent = objTree.Nodes.Add(nodCurrent, tvwChild, , "Dummy") End If
The only downside is that when you collapse your node, you must delete all nodes and add a dummy node again (unless you check on expand not to add nodes if the first node is not a dummy node). Which means if you have expanded lower levels, and collapse a higher level, you have lost all your lower level expansions if you re-explode again (which I personally never want anyway).
Doing it this way means you only load what you want, and you always have the latest values and do not need to refresh - each node exploded gives you the latest data.
 Signature Kind Regards,
Endré
> Hi Endré, > I don't have any better advice then to find code which cause this crash. [quoted text clipped - 82 lines] > >> > modify the string array, then set the node tag back to the string > >> > array!!!
|
|
|