MID Function from Drop Down List

cstickman

Registered User.
Local time
Today, 03:57
Joined
Nov 10, 2014
Messages
109
Hello Everyone,

I am trying to write an IF statement that will break apart one drop down list by using the MID Function. Here is the code that I have:

Code:
 If Mid(Me.List23, 5, 3) = "CNT" Then
        NetworkDate_Click
    ElseIf Mid(Me.List23, 5, 3) = "CNW" Then
        NetworkDate_Click
    ElseIf Mid(Me.List23, 5, 3) = "CNZ" Then
        NetworkDate_Click
    End If

The List23 box has 1454CNTABC so it should run the NetworkDate_Click sub, but instead it is not working. I am not sure what I am doing wrong and why it is not reading the list box value. Any help or suggestions would be greatly appreciated. Thanks!!
 
Code:
 select case Mid(Me.List23, 5, 3) 
  case  "CNT" ,"CNW","CNZ"
     NetworkDate_Click
End select
or just put the items in the list box
select mid([field],5,3) as Item from table
 
I suggest putting

Code:
Debug.Print  Mid(Me.List23, 5, 3)

before this code so that you can see what's happening. Did a space creeping into " 1454CNTABC" by any chance?
 
is the length of the numeric value in the string always 4?
 

Users who are viewing this thread

Back
Top Bottom