LIKE operator difficulty 
Author Message
 LIKE operator difficulty

Vba-LIKE operator difficulty
Hi,
The code below doesn’t work properly, the last IF condition is always executed,
never the others although currently I was only entering 1000 (1st condition
satisfied) all the time, but “Menu” never opened, “Manager Menu” does. Any
suggestions?
Thanks!

Private Sub setMenu()

    If Me![txtRegionCode] = "##00" Then
       stDocName = "Menu"
    Else
        If Me![txtRegionCode] = "##99" Then
            stDocName = "Data Entry Menu"
    Else
            If Me![txtRegionCode] <> "##99" And Me![txtRegionCode] <> "##00" Then
                stDocName = "Manager Menu"
            End If
        End If
    End If
End Sub



Mon, 07 Jul 2003 23:20:37 GMT  
 LIKE operator difficulty
I will assume that you are attempting to use ## as a wildcard match...

Private Sub setMenu()
    Select Case Right(Me!txtRegionCode,2)
        Case "00"
           stDocName = "Menu"
        Case "99"
            stDocName = "Data Entry Menu"
        Case  Else
            stDocName = "Manager Menu"
   End Select
End Sub


Vba-LIKE operator difficulty
Hi,
The code below doesn&#8217;t work properly, the last IF condition is always
executed,
never the others although currently I was only entering 1000 (1st condition
satisfied) all the time, but &#8220;Menu&#8221; never opened, &#8220;Manager
Menu&#8221; does. Any
suggestions?
Thanks!

Private Sub setMenu()

    If Me![txtRegionCode] = "##00" Then
       stDocName = "Menu"
    Else
        If Me![txtRegionCode] = "##99" Then
            stDocName = "Data Entry Menu"
    Else
            If Me![txtRegionCode] <> "##99" And Me![txtRegionCode] <> "##00"
Then
                stDocName = "Manager Menu"
            End If
        End If
    End If
End Sub



Tue, 08 Jul 2003 00:12:52 GMT  
 LIKE operator difficulty
Hi
yes, the first 2 numbers aren't important for me at the moment, the last
2 however are.
Quote:
-----Original Message-----

I will assume that you are attempting to use ## as a wildcard match...

Private Sub setMenu()
    Select Case Right(Me!txtRegionCode,2)
        Case "00"
           stDocName = "Menu"
        Case "99"
            stDocName = "Data Entry Menu"
        Case  Else
            stDocName = "Manager Menu"
   End Select
End Sub



Vba-LIKE operator difficulty
Hi,
The code below doesn&#8217;t work properly, the last IF condition is always
executed,
never the others although currently I was only entering 1000 (1st condition
satisfied) all the time, but &#8220;Menu&#8221; never opened, &#8220;Manager
Menu&#8221; does. Any
suggestions?
Thanks!

Private Sub setMenu()

    If Me![txtRegionCode] = "##00" Then
       stDocName = "Menu"
    Else
        If Me![txtRegionCode] = "##99" Then
            stDocName = "Data Entry Menu"
    Else
            If Me![txtRegionCode] <> "##99" And Me![txtRegionCode] <> "##00"
Then
                stDocName = "Manager Menu"
            End If
        End If
    End If
End Sub

.



Tue, 08 Jul 2003 00:47:40 GMT  
 LIKE operator difficulty
hey thanks for your code it works great, but why wouldn't my initial code run?
Quote:
-----Original Message-----

Hi
yes, the first 2 numbers aren't important for me at the moment, the last
2 however are.

-----Original Message-----
I will assume that you are attempting to use ## as a wildcard match...

Private Sub setMenu()
    Select Case Right(Me!txtRegionCode,2)
        Case "00"
           stDocName = "Menu"
        Case "99"
            stDocName = "Data Entry Menu"
        Case  Else
            stDocName = "Manager Menu"
   End Select
End Sub



Vba-LIKE operator difficulty
Hi,
The code below doesn&#8217;t work properly, the last IF condition is always
executed,
never the others although currently I was only entering 1000 (1st condition
satisfied) all the time, but &#8220;Menu&#8221; never opened, &#8220;Manager
Menu&#8221; does. Any
suggestions?
Thanks!

Private Sub setMenu()

    If Me![txtRegionCode] = "##00" Then
       stDocName = "Menu"
    Else
        If Me![txtRegionCode] = "##99" Then
            stDocName = "Data Entry Menu"
    Else
            If Me![txtRegionCode] <> "##99" And Me![txtRegionCode] <> "##00"
Then
                stDocName = "Manager Menu"
            End If
        End If
    End If
End Sub

..

.



Tue, 08 Jul 2003 01:04:38 GMT  
 LIKE operator difficulty
Because you were checking for a literal string, containing ## signs. And
these are not there.

--
Thank you. Regards,
Bas Cost Budde, Holland
website at http://utopia.knoware.nl/users/hegedu
mail needs a k after the at

hey thanks for your code it works great, but why wouldn't my initial code
run?

Quote:
-----Original Message-----

Hi
yes, the first 2 numbers aren't important for me at the moment, the last
2 however are.

-----Original Message-----
I will assume that you are attempting to use ## as a wildcard match...

Private Sub setMenu()
    Select Case Right(Me!txtRegionCode,2)
        Case "00"
           stDocName = "Menu"
        Case "99"
            stDocName = "Data Entry Menu"
        Case  Else
            stDocName = "Manager Menu"
   End Select
End Sub



Vba-LIKE operator difficulty
Hi,
The code below doesn&#8217;t work properly, the last IF condition is always
executed,
never the others although currently I was only entering 1000 (1st condition
satisfied) all the time, but &#8220;Menu&#8221; never opened, &#8220;Manager
Menu&#8221; does. Any
suggestions?
Thanks!

Private Sub setMenu()

    If Me![txtRegionCode] = "##00" Then
       stDocName = "Menu"
    Else
        If Me![txtRegionCode] = "##99" Then
            stDocName = "Data Entry Menu"
    Else
            If Me![txtRegionCode] <> "##99" And Me![txtRegionCode] <> "##00"
Then
                stDocName = "Manager Menu"
            End If
        End If
    End If
End Sub

..

.



Tue, 08 Jul 2003 01:44:29 GMT  
 LIKE operator difficulty

Quote:

>why wouldn't my initial code run?

Because you were using LIKE wildcards but not using the LIKE operator.
The = sign tests for *equality* and knows nothing about wildcards.
Furthermore, LIKE is a SQL operator not a VBA operator!

           John W. Vinson[MVP]    
http://go.compuserve.com/msdevapps?loc=us&access=public



Tue, 08 Jul 2003 10:41:59 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Copy read-only liked tables

2. Visual Liking in .Net using TREE VIEW control

3. DDE and the likes

4. Likes CAT and Sport Query

5. Noone likes newbies??

6. TOOLBAR LIKES IE3.0

7. Outlook liked form design

8. Outlook liked form design

9. Outlook liked form design

10. Outlook liked form design

11. no one likes the DATA CONTROL

12. Outlook liked form design

 

 
Powered by phpBB® Forum Software