Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Now this is bad....

Now this is bad....

Scheduled Pinned Locked Moved The Weird and The Wonderful
21 Posts 18 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E emartinho

    EDIT: This is LOOOONG. Sorry. :D The following code is used to create "WHERE" clause criteria, for all possible cominations of 8 "class" parameters if the "group_a" parameter is passed with a value. I know there's a better way of doing this, but I can't be bothered to unravel this convoluted piece of code! :laugh:

    Function grpStatement(group_a As String, class_aa As String, class_ab As String, class_ac As String, _
    class_ad As String, class_ae As String, class_af As String, class_ag As String, _
    class_ah As String, classCondition_a As String) As String

    Dim groupCondition_a As String

    If group\_a <> "" Then
        If class\_aa <> "" Then
            classCondition\_a = classCondition\_a & "'" & class\_aa & " %'"
            If class\_ab <> "" Then
                classCondition\_a = classCondition\_a & " OR Level4 LIKE '" & class\_ab & " %'"
                If class\_ac <> "" Then
                    classCondition\_a = classCondition\_a & " OR Level4 LIKE '" & class\_ac & " %'"
                    If class\_ad <> "" Then
                        classCondition\_a = classCondition\_a & " OR Level4 LIKE '" & class\_ad & " %'"
                        If class\_ae <> "" Then
                            classCondition\_a = classCondition\_a & " OR Level4 LIKE '" & class\_ae & " %'"
                            If class\_af <> "" Then
                                classCondition\_a = classCondition\_a & " OR Level4 LIKE '" & class\_af & " %'"
                                If class\_ag <> "" Then
                                    classCondition\_a = classCondition\_a & " OR Level4 LIKE '" & class\_ag & " %'"
                                    If class\_ah <> "" Then
                                        classCondition\_a = classCondition\_a & " OR Level4 LIKE '" & class\_ah & " %'"
                                    End If
                                ElseIf class\_ah <> "" Then
                                    classCondition\_a = classCondition\_a & " OR Level4 LIKE '" & class\_ah & " %'"
                                End If
                            ElseIf class\_ag <> "" Then
                                classCondition\_a = classCondition\_a & " OR Level4 LIKE '" & class\_ag & " %'"
                                If class\_ah <> "" Then
    
    R Offline
    R Offline
    Ravi Sant
    wrote on last edited by
    #21

    :wtf: He must be suggested to join anti-if campaign.

    // ♫ 99 little bugs in the code, // 99 bugs in the code // We fix a bug, compile it again // 101 little bugs in the code ♫

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups