473,321 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

run-time error 29068 by deleting modules

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
2 3294
On Fri, 13 Apr 2007 11:56:02 +0200, "Cesar Romani"
<ce**********@yahoo.itwrote:

You may need to restructure that code. I can see you already tried to
loop from N-1 down to 0, but you may want to repeatedly delete item 0,
and in the loop refresh the Modules collection after each delete.

-Tom.

>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 #2
On Apr 13, 2:56 am, "Cesar Romani" <cesar_rom...@yahoo.itwrote:
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
Tom could be right, but it puzzles me why this won't work as this is
the loop I would have started with too. To find out what is going on,
debug.print (or msgbox) the name. That might shed some light on it.
When you find out, please post so we can see what the issue was.

-- Larry Engles

Apr 13 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: leroybt.rm | last post by:
Can someone tell me how to run a script from a interactive shell I type the following: >>>python filename >>>python filename.py >>>run filename >>>run filename.py >>>/run filename >>>/run...
4
by: Ed | last post by:
Hello, I took a course in asp about 2 years ago and I was practicing with IIS 5.0. Then I put it down for a while. Now trying to get back to it. I can't run asp files from subdirectories of...
6
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are...
13
by: Bob Day | last post by:
Using vs2003, vb.net I start a thread, giving it a name before start. Code snippet: 'give each thread a unique name (for later identification) Trunk_Thread.Name = "Trunk_0_Thread" ' allow...
19
by: Bryan | last post by:
How can i run a bit of code straight from the IDE? Right now i make a temporary button and put the code behind that, then i run debug mode and click on the button. Is there a way to highlight...
9
by: Brett Wesoloski | last post by:
I am new to VS2005. I changed my program.cs file to be a different form I am working on. But when I go to run the application it still brings up the form that was originally declared as new. ...
7
by: Lee Crabtree | last post by:
I remember when I was first getting into .NET Forms programming that there was a rather emphatic rule about not constructing a form before calling Application.Run with it. So this: ...
8
by: David Thielen | last post by:
Hi; In our setup program how do I determine if I need to run "aspnet_regiis –i" and if so, is there an API I can calll rather than finding that program on the user's disk and calling it? --...
3
by: traceable1 | last post by:
Is there a way I can set up a SQL script to run when the instance starts up? SQL Server 2005 SP2 thanks!
7
by: mxdevit | last post by:
Task: run application from ASP.NET for example, you have a button on ASP.NET page, when press this button - one application is invoked. the code to run application (for example, notepad) is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.