473,386 Members | 1,860 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,386 software developers and data experts.

Help~how do I do nested if?

Hi... would like to start off a little useless info. about myself... first time using VB... totally confused and lost... treat me as a retarded and thanks for your help in advance.

I get the "Block if without end if" error on the codes below. I don't see where I am missing an End If... please help~ ;)
Expand|Select|Wrap|Line Numbers
  1.     If myChoice = "CREATION" Then
  2.     Dim c As Range
  3.     For Each c In Sheets("RMs").Range("F2:F500")
  4.         If c.Value = TextBox_SecCode.Value Then
  5.           MsgBox "SecCode already exists. Please input a different SecCode."
  6.           Exit Sub
  7.         Else
  8.           rsT.Fields("SecCode").Value = TextBox_SecCode.Value
  9.         End If
  10.     Next
Sep 11 '07 #1
5 1089
Killer42
8,435 Expert 8TB
Well, going only by the code you posted, you are missing an End If to close the If block opened on the very first line.
Sep 11 '07 #2
Thanks very much for your reply. So I suppose that that End If should be added after Next right?
Sep 11 '07 #3
Killer42
8,435 Expert 8TB
Thanks very much for your reply. So I suppose that that End If should be added after Next right?
Very likely, in my opinion.
Sep 11 '07 #4
sgrec7
59
Very likely, in my opinion.
Is it not programming etiquette to use white space and correct indenting?

That's what I learnt!

Anyway:

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. if 3 = 3 then
    if 3 < 6 then
    end
    End IF
    endif
  4.  
  5.  
I learnt that last year in YR 9 !

Hey everybody guess what ?

Tomorrow is A Merry Can's 9/11

So take a minute's silence.

sgrec7
Sep 11 '07 #5
Killer42
8,435 Expert 8TB
Is it not programming etiquette to use white space and correct indenting?
Sigh... there goes my nice round 5555 message count. :(

Anyway...

I agree that indenting is extremely important in producing understandable code. As for the "white space" I would say that's more of a personal preference and tends to vary a lot. But then I never "learned" programming, just picked it up as I went along.

In fact, I think it makes code look a lot worse if you have gaps between all the lines. I think gaps should be used to separate code into logical blocks. In the case of this nested IF situation, I'd probably consider that all to be a single block. Unless there was some fairly complex stuff in there, which might need to be broken up for readability.
Sep 12 '07 #6

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

Similar topics

1
by: Eric in somewhere | last post by:
How to install J2SE 1.4.2 with NetBeans IDE on WindowsME? When I install it till 6%, a DOS window opened and then closed, then the process stop here. How can fix it? Please help.
6
by: ritagoldman101 | last post by:
Pls help - how to find Domain owner For most people this may be an easy question...but not for me. How can I find out who the owner of a domain is so I can write to her / him and ask if she /...
1
by: Alan & Sharron Brown | last post by:
'Help - How can you run 2 versions of Access on 1 pc' I would like to run Access 97 and Access 2003 on the same PC but have error
0
by: YiTian_Ken | last post by:
Help!!How to use MSMQ in WebForm? I can not send any Message from MSMQ?
6
by: hb | last post by:
Hi, Would you please tell me how to detect if the client's browser is closed? I need such event to trigger a database modification. Thank you hb
2
by: Ceema M via DotNetMonster.com | last post by:
Hello all, I have a nested repeater, which displays categories(parent repeater) and corresponding subcategories(child repeater). Both repeaters have checkboxes. When I check category checkbox...
4
by: txican | last post by:
the HTML is: ---------------------------------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html> <head> <title>foo</title>...
4
by: jadeivel756 | last post by:
I BADLY NEED YOUR HELP...... HELP... hOW TO Pass value to a struct type and permanently store the data after youve given the data.The programming language is C. My problem is that as I exit the...
0
by: rafeig77 | last post by:
I want help How I can align rectangles differ in its tow dimensions inside big rectangle with lesser waste in area ? for mor information align.rar - 1.8 Kb or: copy this code to text file...
11
by: lenygold via DBMonster.com | last post by:
I am tryieng to convert our time consuming recursive queries too very efficient queries based on nested set model. The only problem is to convert an adjacency list model into a nested set model,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.