Take the 2-minute tour ×

I have recently learned to slice a string in python programming:

>>> word = "Coffee"
>>> word[-3:]
>>> 'fee'

I want to do the same thing in vb. I tried to create a conditional state as follows:

If Me.FIELD1.Length > 2 Then
    Me.FIELD1 = Me.FIELD1[-3:5]

This seems to error out. I'm not sure if vb does slicing the same way python does. Can anyone suggest how to do this?

share|improve this question
I don't know Python at all, so I have no idea what that slicing syntax does. But in VB, you can use the Split function to split a string. –  Cody Gray Apr 13 '12 at 21:47
Also, you need to be clear about whether you're using VB 6 or VB.NET. They're very different languages with very different available functions. –  Cody Gray Apr 13 '12 at 22:02
add comment

2 Answers

 Me.FIELD1 = Me.FIELD1.Substring(3);

this will return fee See VB.Net Substring Example

share|improve this answer
add comment

You need to looking into the String.Left, String.Substring, and String.Right functions.

share|improve this answer
Thanks SouthShoreAK! –  Mike Apr 16 '12 at 20:37
add comment

Your Answer


