![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am using a treeview type menu system on an Access 2010 Db. There is a close button on the menuform which runs RunCommand acCmdExit. All works normally on the AccDb If I create an AccDe from this, all works OK the first time I close the database. On subsequent closures I always get the message "Key is not unique in collection", then a further message "This key is already associated with an element of this collection". The lines on the treeview control vanish. The error appears to occurr after the unload event, but before the close event. Then the Db closes OK. Any bright ideas please. Thanks Phil |
#3
| |||
| |||
|
|
"Phil" <phil (AT) stantonfamily (DOT) co.uk> wrote in message news:4M-dndKuE_si7dTRnZ2dnUVZ8uidnZ2d (AT) brightview (DOT) co.uk... I am using a treeview type menu system on an Access 2010 Db. There is a close button on the menuform which runs RunCommand acCmdExit. All works normally on the AccDb If I create an AccDe from this, all works OK the first time I close the database. On subsequent closures I always get the message "Key is not unique in collection", then a further message "This key is already associated with an element of this collection". The lines on the treeview control vanish. The error appears to occurr after the unload event, but before the close event. Then the Db closes OK. Any bright ideas please. Thanks Phil Not sure why you're getting the error, and only in those particular circumstances, but you could try a workaround. Try putting: Treeview1.Nodes.Clear before you quit the app. After all, if the form is closing you don't need the Nodes collection any more. Also you could try using Application.Quit instead of the RunCommand statement. (replace Treeview1 with your control's name) |
#4
| |||
| |||
|
|
On 23/07/2010 12:00:51, "Stuart McCall" wrote: "Phil" <phil (AT) stantonfamily (DOT) co.uk> wrote in message news:4M-dndKuE_si7dTRnZ2dnUVZ8uidnZ2d (AT) brightview (DOT) co.uk... I am using a treeview type menu system on an Access 2010 Db. There is a close button on the menuform which runs RunCommand acCmdExit. All works normally on the AccDb If I create an AccDe from this, all works OK the first time I close the database. On subsequent closures I always get the message "Key is not unique in collection", then a further message "This key is already associated with an element of this collection". The lines on the treeview control vanish. The error appears to occurr after the unload event, but before the close event. Then the Db closes OK. Any bright ideas please. Thanks Phil Not sure why you're getting the error, and only in those particular circumstances, but you could try a workaround. Try putting: Treeview1.Nodes.Clear before you quit the app. After all, if the form is closing you don't need the Nodes collection any more. Also you could try using Application.Quit instead of the RunCommand statement. (replace Treeview1 with your control's name) Thanks for coming back. The Treeview1.Nodes.Clear stops the first error message, but not the "This key is already associated with an element of this collection" error |
|
I know it's bad practice, but I set the Db to compactg on exit. The Db is a BE only, so why it grows, I'm not sure but it does. The Application.Quit does not allow the compact to run whilst the RunCommand acCmdExit does. If I use the Application.Quit I get no error messages however |
|
Phil |
#5
| |||
| |||
|
|
I know it's bad practice, but I set the Db to compactg on exit. The Db is a BE only, so why it grows, I'm not sure but it does. The Application.Quit does not allow the compact to run whilst the RunCommand acCmdExit does. If I use the Application.Quit I get no error messages however |
#6
| |||
| |||
|
|
"Phil" <phil (AT) stantonfamily (DOT) co.uk> wrote in news:b_2dnTpDbP7AHdTRnZ2dnUVZ8kWdnZ2d (AT) brightview (DOT) co.uk: I know it's bad practice, but I set the Db to compactg on exit. The Db is a BE only, so why it grows, I'm not sure but it does. The Application.Quit does not allow the compact to run whilst the RunCommand acCmdExit does. If I use the Application.Quit I get no error messages however There is simply no reason for compact on close. Lose it. |
#7
| |||
| |||
|
|
"Phil" <phil (AT) stantonfamily (DOT) co.uk> wrote in message news:b_2dnTpDbP7AHdTRnZ2dnUVZ8kWdnZ2d (AT) brightview (DOT) co.uk... On 23/07/2010 12:00:51, "Stuart McCall" wrote: "Phil" <phil (AT) stantonfamily (DOT) co.uk> wrote in message news:4M-dndKuE_si7dTRnZ2dnUVZ8uidnZ2d (AT) brightview (DOT) co.uk... I am using a treeview type menu system on an Access 2010 Db. There is a close button on the menuform which runs RunCommand acCmdExit. All works normally on the AccDb If I create an AccDe from this, all works OK the first time I close the database. On subsequent closures I always get the message "Key is not unique in collection", then a further message "This key is already associated with an element of this collection". The lines on the treeview control vanish. The error appears to occurr after the unload event, but before the close event. Then the Db closes OK. Any bright ideas please. Thanks Phil Not sure why you're getting the error, and only in those particular circumstances, but you could try a workaround. Try putting: Treeview1.Nodes.Clear before you quit the app. After all, if the form is closing you don't need the Nodes collection any more. Also you could try using Application.Quit instead of the RunCommand statement. (replace Treeview1 with your control's name) Thanks for coming back. The Treeview1.Nodes.Clear stops the first error message, but not the "This key is already associated with an element of this collection" error Do the treeview's lines still vanish? If not, then the 2nd error is unlikely to be a problem with the treeview (I think). |
|
I know it's bad practice, but I set the Db to compactg on exit. The Db is a BE only, so why it grows, I'm not sure but it does. The Application.Quit does not allow the compact to run whilst the RunCommand acCmdExit does. If I use the Application.Quit I get no error messages however Well I didn't know that Application.Quit stopped an auto-compact. Hmm. Incidentally, your BE shouldn't be growing like that, unless you're running lots of delete and append queries. I'd be tempted to create a new db and import everything into it from your BE. Can't hurt, and it might clear up the problem. (can you tell I'm guessing?) Have recenly rebuilt the Db but have always had this problem. |
|
Phil |
#8
| |||
| |||
|
|
On 23/07/2010 17:56:15, "Stuart McCall" wrote: "Phil" <phil (AT) stantonfamily (DOT) co.uk> wrote in message news:b_2dnTpDbP7AHdTRnZ2dnUVZ8kWdnZ2d (AT) brightview (DOT) co.uk... On 23/07/2010 12:00:51, "Stuart McCall" wrote: "Phil" <phil (AT) stantonfamily (DOT) co.uk> wrote in message news:4M-dndKuE_si7dTRnZ2dnUVZ8uidnZ2d (AT) brightview (DOT) co.uk... I am using a treeview type menu system on an Access 2010 Db. There is a close button on the menuform which runs RunCommand acCmdExit. All works normally on the AccDb If I create an AccDe from this, all works OK the first time I close the database. On subsequent closures I always get the message "Key is not unique in collection", then a further message "This key is already associated with an element of this collection". The lines on the treeview control vanish. The error appears to occurr after the unload event, but before the close event. Then the Db closes OK. Any bright ideas please. Thanks Phil Not sure why you're getting the error, and only in those particular circumstances, but you could try a workaround. Try putting: Treeview1.Nodes.Clear before you quit the app. After all, if the form is closing you don't need the Nodes collection any more. Also you could try using Application.Quit instead of the RunCommand statement. (replace Treeview1 with your control's name) Thanks for coming back. The Treeview1.Nodes.Clear stops the first error message, but not the "This key is already associated with an element of this collection" error Do the treeview's lines still vanish? If not, then the 2nd error is unlikely to be a problem with the treeview (I think). After your suggestion of .Nodes.Clear, I am only left with 2 entries on the Treeview control. The lines still connect these 2 when the err4or message shows up I know it's bad practice, but I set the Db to compactg on exit. The Db is a BE only, so why it grows, I'm not sure but it does. The Application.Quit does not allow the compact to run whilst the RunCommand acCmdExit does. If I use the Application.Quit I get no error messages however Well I didn't know that Application.Quit stopped an auto-compact. Hmm. Incidentally, your BE shouldn't be growing like that, unless you're running lots of delete and append queries. I'd be tempted to create a new db and import everything into it from your BE. Can't hurt, and it might clear up the problem. (can you tell I'm guessing?) Have recenly rebuilt the Db but have always had this problem. It might?? be caused by using a program called "ShrinkerStretcher" from Peter's Software which the controls and fonts on forms as you change the size of the form. This does add and delete a temporary table, but I still get the growth problem even if I don't use the ShrinkerStretcher routine. On th other hand it might gave something to do with using a ImageListCtrl to hold the icons I use for the treeview control, but they are constant. Never have worked out when they are loaded. Phil |
#9
| |||
| |||
|
|
I think I have cured the problem. My menu opens another hidden form that has the ImageList control on it that holds the icons displayed in the Treeview. If I close that, the problem ssems to have vanished. Odd though that the 2 errors were only apparent in the AccDe, not the AccDb Thaks for your help Phil |
#10
| |||
| |||
|
|
On 23/07/2010 20:36:40, "David W. Fenton" wrote: "Phil" <phil (AT) stantonfamily (DOT) co.uk> wrote in news:b_2dnTpDbP7AHdTRnZ2dnUVZ8kWdnZ2d (AT) brightview (DOT) co.uk: I know it's bad practice, but I set the Db to compactg on exit. The Db is a BE only, so why it grows, I'm not sure but it does. The Application.Quit does not allow the compact to run whilst the RunCommand acCmdExit does. If I use the Application.Quit I get no error messages however There is simply no reason for compact on close. Lose it. David, Any idea what makes it grow? |
|
Have opeb the AccDb 3 times and openad a couple of forms. Sizes were 17928KB (After compact) 18008KB, 18080. Similarly withe the AccDE sizes were 18816, 18940, 19000. 19008 |
![]() |
| Thread Tools | |
| Display Modes | |
| |