Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2009
    Location
    SLOVAKIA,Bratislava
    Posts
    70

    Lightbulb Unanswered: CrashMaker-COLON

    Hi,
    The Long lines with ':' - COLONs (Command separator) is really another crash maker,my expierience...
    Example:
    Code:
    i_1 = i_1 + i_2 + i_3 : i_2 = function_call_a : str1 = "abc..." & str2 & str3 : ....
    15 years db-programmer(dBase,FoxPro,MS Access 2002/2003),Symbian C++

  2. #2
    Join Date
    Mar 2009
    Posts
    5,441
    Provided Answers: 14
    That's also something that should be avoided at all cost.

    Have a nice day!

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    I only very rarely use colons to separate commands. It just never makes sense to do it as it just makes the code harder to read and debug later. The number of vertical lines of code is irrelevant, so yeah, I really see no need to do it.

    The only time I have is setting defaults:

    A = 1: B = 1: C = 1

    I have done this from time to time, but it's still really of no benefit to save vertical space;

    A = 1
    B = 1
    C = 1

    Is just as good and a little easier to read.

    But I also see no reason why the colon would cause crashes.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  4. #4
    Join Date
    Mar 2009
    Posts
    5,441
    Provided Answers: 14
    Right StarTrekker. The only situation where I (very seldom) use them are with a Select Case construction, like this:

    Code:
           Select Case lngObjectType
                Case SYS_COUNTER:           varObjectValue = CLng(strData)
                Case SYS_NAME:              varObjectValue = CStr(strData)
                Case SYS_NUMBER:            varObjectValue = CDbl(strData)
                Case SYS_TEXT:              varObjectValue = CStr(strData)
                Case SYS_LOGICAL:           varObjectValue = CBool(strData)
                Case SYS_DATE:              varObjectValue = CVar(strData)
                Case SYS_CURRENCY:          varObjectValue = CCur(strData)
                Case SYS_COMMENT:           varObjectValue = CStr(strData)
                Case SYS_COMMENTEXTENDED:   varObjectValue = CStr(strData)
                Case SYS_COLUMN:            varObjectValue = CInt(strData)
            End Select
    It does not change anything to the code but I find it easier to read that way.

    Have a nice day!

  5. #5
    Join Date
    Mar 2009
    Location
    SLOVAKIA,Bratislava
    Posts
    70
    But I also see no reason why the colon would cause crashes.
    I am really NOT SHURE about it !!!
    Problem is , this occurs NOT Allways only sometimes...
    __________________
    StarTrekker
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    ------------------------
    My problem history:
    1.
    I had a very big number of COLONS(many tausend's) in my code , through MZ Tools, i had Split this long lines to short lines with Continue-line marker
    But still CRASHES......
    2.
    Now i had removed all the Command-colons from my code , NOT manually ,
    but through the code (very dangerous operation ! )
    Now realy LESS Crashes than before
    3.
    Probably i will remove this Continue-line marker's , from short lines ( max character per line = ~ 80/100)
    But for my LONG-SQL commands i am using it somewhere
    cSQL = "select ......" & _
    "where...." & _
    ....
    "a=b....."
    ----------------------------
    cSQL = "select ......" & _
    cSQL = cSQL & "where...." & _
    ....
    cSQL = cSQL & "a=b....."
    another solution, but here i have Compiler problems, some parts of string are "" (NullStrings !!!)
    ----------------------------
    ALL THE BEST IS TEST !!!
    My DB that permanent crashes( with tausend of Colons,and Short Declarations $,&):
    Home ?(pacala)?
    file: Access_unrecognised_format__D_MOJE.zip
    15 years db-programmer(dBase,FoxPro,MS Access 2002/2003),Symbian C++

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •