From: Stuart McCall on 23 Jul 2010 07:00 "Phil" <phil(a)stantonfamily.co.uk> wrote in message news:4M-dndKuE_si7dTRnZ2dnUVZ8uidnZ2d(a)brightview.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)
From: Phil on 23 Jul 2010 07:43 On 23/07/2010 12:00:51, "Stuart McCall" wrote: > "Phil" <phil(a)stantonfamily.co.uk> wrote in message > news:4M-dndKuE_si7dTRnZ2dnUVZ8uidnZ2d(a)brightview.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
From: Stuart McCall on 23 Jul 2010 12:56 "Phil" <phil(a)stantonfamily.co.uk> wrote in message news:b_2dnTpDbP7AHdTRnZ2dnUVZ8kWdnZ2d(a)brightview.co.uk... > On 23/07/2010 12:00:51, "Stuart McCall" wrote: >> "Phil" <phil(a)stantonfamily.co.uk> wrote in message >> news:4M-dndKuE_si7dTRnZ2dnUVZ8uidnZ2d(a)brightview.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?) > > Phil >
From: David W. Fenton on 23 Jul 2010 15:36 "Phil" <phil(a)stantonfamily.co.uk> wrote in news:b_2dnTpDbP7AHdTRnZ2dnUVZ8kWdnZ2d(a)brightview.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 W. Fenton http://www.dfenton.com/ contact via website only http://www.dfenton.com/DFA/
From: Phil on 23 Jul 2010 18:25 On 23/07/2010 20:36:40, "David W. Fenton" wrote: > "Phil" <phil(a)stantonfamily.co.uk> wrote in > news:b_2dnTpDbP7AHdTRnZ2dnUVZ8kWdnZ2d(a)brightview.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 Phil
|
Next
|
Last
Pages: 1 2 Prev: key is not unique in collection Next: Multiple queries into a single report |