delete a character in a string from a specific position

EzIA

Registered User.
Local time
Today, 13:23
Joined
Sep 27, 2009
Messages
10
Hi all

This is a ridiculous question but I cant seem to find an answer.
I'm working with VB on Access 2007.
In other programming languages I know I use strings as arrays. This doesnt seem to be the case here and it gives me a headache.

let's say I want to delete the third character in the string "hello!".
how do I go about that? - I've read many threads about "replace" or "mid" but cant seem to get it to work.

thanks for the help
 
You could use replace

Me.SomeTextBox = Replace(Me.SomeTextBox, Mid(Me.SomeTextBox, 3, 1), vbNullString)
 
Oops, guess not like that.

It will need

Me.SomeTextBox = Left(Me.SomeTextBox, 2) & Mid(Me.SomeTextBox, 4)

because if you use the original code I gave it will replace ALL of the same letters as the third character (delete them).
 
wouldnt this delete all the "l" characters and not just the third?
 
thanks - this should do the work....
Not very elegant but does the job! :)
 

Users who are viewing this thread

Back
Top Bottom