Error Number 29068
Cesar Romani Guest I'm trying to delete all class modules whose name begin with "struct". If I use the following subroutine, it deletes only one module and spits the run-time error 29068: "cannot complete this operation. You must stop the code and try again" Where is the error here? --------------------- Sub deleteModules() Dim i As Integer For i = CurrentProject.AllModules.Count - 1 To 0 Step -1 If Left(CurrentProject.AllModules(i).Name, 6) = "struct" Then DoCmd.DeleteObject acModule, CurrentProject.AllModules(i).Name End If Next i End Sub --------------------- Many thanks in advance, Cesar Cesar Romani, Apr 11, 2007 #1 Advertisements Maurice Guest Could it be that the code you are running is referring to a "struct"-module or is the actual code in a "struct"-module? Maurice "Cesar Romani" wrote: > I'm trying to delete all class modules whose name begin with "struct". > If I use the following subroutine, it deletes only one module and spits the > run-time error 29068: "cannot complete this operation. You must stop the > code and try > again" > Where is the error here? > --------------------- > Sub deleteModules() > Dim i As Integer > > For i = CurrentProject.AllModules.Count - 1 To 0 Step -1 > If Left(CurrentProject.AllModules(i).Name, 6) = "struct" Then > DoCmd.DeleteObject acModule, CurrentProject.AllModules(i).Name > End If > Next i > End Sub > --------------------- > Many thanks in advance, > > Cesar > > > Maurice, May 4, 2007 #2 Advertisements Guest Guest I haven't tried it :~) But I will be surprised if you are able to delete modules in the current project. Deleting a module puts the project in a de-compiled state. The code can't run when the project is in a de-compiled state: it needs to re-compile. The project can't re-compile while you are running code: you need to stop the code and try again. Try changing the VBA properties so that it does not automatically compile (this is opposite to the usual recommendation). Try using a separate Access.Application object, so that you can run the code in one Application object, to delete the modules in a different Application object. (david) "Cesar Romani" <> wrote in message news:A77Th.28449$... > I'm trying to delete all class modules whose name begin with "struct". >
Join INTELLIGENT WORK FORUMSFOR COMPUTER PROFESSIONALS Log In Come Join Us! Are you aComputer / IT professional?Join Tek-Tips Forums! Talk With Other Members Be Notified Of ResponsesTo Your Posts Keyword Search One-Click Access To YourFavorite Forums Automated SignaturesOn Your Posts Best Of All, It's Free! Join Us! *Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting Guidelines Promoting, selling, recruiting, coursework and thesis posting is forbidden.Tek-Tips Posting Policies Jobs Jobs from Indeed What: Where: jobs by Link http://www.office-forums.com/threads/run-time-error-29068-by-deleting-modules.683477/ To This Forum! Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.Just copy and paste the BBCode HTML Markdown MediaWiki reStructuredText code below into your site. Microsoft: Access Other topics Forum at Tek-Tips HomeForumsProgrammersDBMS PackagesMicrosoft: Access Other topics Forum Run-time error 29068 You must stop the code and try again. thread181-401597 Forum Search FAQs Links http://www.tek-tips.com/viewthread.cfm?qid=401597 MVPs Run-time error 29068 You must stop the code and try again. Run-time error 29068 You must stop the code and try again. rssql (Programmer) (OP) 8 Nov 02 20:52 this is weird..Run-time error 29068Microsoft Access cannot complete this operation. You must stop the code and try again.I've seen it couple times. It errors on the CopyObject statement. Most recently when the following code runs:****************************DoCmd.SetWarnings False 'turns off messagesDoCmd.CopyObject , "FinancialCoverSheet", acForm, "FinancialCoverSheetOriginal"DoCmd.SetWarnings True 'turns on messages****************************i'm trying to copy a form, so i can make changes with my code. It all works, but sometimes it gives the error. RE: Run-time error 29068 You must stop the code and try again. WildHare (MIS) 9 Nov 02 14:18 Turn off the SetWarnings FALSE guy, and see what happens to generate the error. Could be a SECOND copy blows up because the first COPY is already there? Me? Ambivalent? Well, yes and no....Another free Access forum:www.forumco.com/jmhareMore Access stuff atwww.jmhare.com/wildhare2.htm Red Flag This Post Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, fl
...You must stop the code and try again. Message #1 by "Jeff Estal"
help? Post your question and get tips & solutions from a community of 418,536 IT Pros & Developers. It's quick & easy. run-time error 29068 by deleting modules P: n/a Cesar Romani I'm trying to delete all class modules whose name begin with "struct". If I use the following subroutine, it deletes only one module and spits the run-time error 29068: "cannot complete this operation. You must stop the code and try again" Where is the error here? --------------------- Sub deleteModules() Dim i As Integer For i = CurrentProject.AllModules.Count - 1 To 0 Step -1 If Left(CurrentProject.AllModules(i).Name, 6) = "struct" Then DoCmd.DeleteObject acModule, CurrentProject.AllModules(i).Name End If Next i End Sub --------------------- Many thanks in advance, Cesar Apr 13 '07 #1 Post Reply Share this Question 2 Replies P: n/a Tom van Stiphout On Fri, 13 Apr 2007 11:56:02 +0200, "Cesar Romani"