473,406 Members | 2,633 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,406 software developers and data experts.

Block If without End If - Darn it!

JustJim
407 Expert 256MB
I've got a very long sub which imports and verifies data from another database and decides which table in my Db to put it into. There is one very long If xxx Then xxx Else xxx statement and in the Then and the Else there are many With..End Withs and Do..Loops and If..End Ifs. I've been careful with my End Ifs, Loops and End Withs as well as being careful with my indenting but I'm still getting the dreaded Block If without End If when I compile.

The ever helpful compiler highlights the End Sub line when it points out my problem. I've been through it very carefully both on screen and on paper but I still can't find the problem.

The actual question is... is there some sort of parser that will take code and format it, either with colours or with indentations to show where this hated error has occurred?

Thanks in advance for any responses.

Jim
Jul 4 '07 #1
4 3964
Rabbit
12,516 Expert Mod 8TB
I've got a very long sub which imports and verifies data from another database and decides which table in my Db to put it into. There is one very long If xxx Then xxx Else xxx statement and in the Then and the Else there are many With..End Withs and Do..Loops and If..End Ifs. I've been careful with my End Ifs, Loops and End Withs as well as being careful with my indenting but I'm still getting the dreaded Block If without End If when I compile.

The ever helpful compiler highlights the End Sub line when it points out my problem. I've been through it very carefully both on screen and on paper but I still can't find the problem.

The actual question is... is there some sort of parser that will take code and format it, either with colours or with indentations to show where this hated error has occurred?

Thanks in advance for any responses.

Jim
Is there another end sub statement in there? Because that will throw an error. End Sub demarcates the end of the Sub and there can only be one per sub.
Jul 4 '07 #2
nico5038
3,080 Expert 2GB
Hi Jim,

In cases like this I often use the elimination trick.
Just save the full code somewhere, remove a large part and execute that part to see or it's OK. Than add more code and continue till the error shows.

Nic;o)
Jul 4 '07 #3
missinglinq
3,532 Expert 2GB
It might help if you could post your code using the code tags. I don't know how to display them here without actually having them interpreted as formatting, but before you code place
[ code = vb] and then after the code [ / code ]

When you actually do this, remove all of the spaces from the tags. This will show the various parts of the code in different colors, and might help us (and yourself) in scanning it and spaotting the problem.

Good Luck!

Linq
Jul 4 '07 #4
JustJim
407 Expert 256MB
It might help if you could post your code using the code tags. I don't know how to display them here without actually having them interpreted as formatting, but before you code place
[ code = vb] and then after the code [ / code ]

When you actually do this, remove all of the spaces from the tags. This will show the various parts of the code in different colors, and might help us (and yourself) in scanning it and spaotting the problem.

Good Luck!

Linq
Thanks for the "Good Luck". It didn't help though. I got in this morning and there had been a "catastrophic server failure" yesterday evening before the daily backup.

I'll start again and hopefully the same mistake won't creep in. It was about 600 lines of code... gone, all gone (sobs).. where did I put that USB stick?

Thanks all for your help. I'l close this thread and if I need more help will start a new one.

Jim
Jul 5 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
14
by: laurence | last post by:
I am implementing a comprehensive image-map generator utility, so have been studying W3C HTML 4.01 Specification (http://www.w3.org/TR/html4/struct/objects.html#h-13.6) on image maps (among other...
11
by: Mark Schneider | last post by:
I'm trying to avoid using <table> for formatting purposes where other, reasonable means exist. I'm stuck trying to find a way to find an equivalent for the code below. <table align="center">...
1
by: col head | last post by:
Hi all, I have a question regarding the configuration in the MS provided UI Process Application Block. I have a feeling that the UI application block itself has the session state (task)...
6
by: grawsha2000 | last post by:
Hi, I'm planing to start using (MSADB) as my data-tier database communiction means. Do you recommond such tool? MTIA, Grawsha
6
by: Jonathan Crawford | last post by:
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +473 Hi I have installed the enterprise library on a development machine and created a project on our webserver. When...
2
by: Jake Barnes | last post by:
Using javascript closures to create singletons to ensure the survival of a reference to an HTML block when removeChild() may remove the last reference to the block and thus destory the block is...
1
by: tracybannon | last post by:
Is it possible to use the ENTLIB Cryptography Block without using a keyfile. In addition to keyfile management my team is also concerned about performance. In this particular instance, we are...
4
by: Mikey C | last post by:
Hi Everyone, I understand in many cases, adding to history when updating window.location.hash is a GOOD thing. In my case, I want to update bookmarkability from javascript (post-load), but...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.