Find string inside a Database String Field

G

Guest

Hi!
I have a table with a field witch properties are Text(200).
Inside I want to search for a word and extract some characters.
Example:
string=

";;__47__notDelegated=N;;__47__accountNeverExpires=Y;;__47__lastLogon=20051027125629;;__... etc... etc"

I want to extract this sequence "lastLogon=20051027125629".
Any Help?
 
D

Douglas J Steele

Assuming the text string is stored in strText, try something like:

Dim intLocation As Integer
dim strLogonInfo As String

intLocation = InStr(strText, "lastLogon=")
If intLocation > 0 Then
' the string was found: take the 24 characters that
' make up lastLogon=xxxxxxxxxxxxxx
strLogonInfo = Mid$(strText, intLocation, 24)
End If


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Nuno Guerra said:
Hi!
I have a table with a field witch properties are Text(200).
Inside I want to search for a word and extract some characters.
Example:
string=
";;__47__notDelegated=N;;__47__accountNeverExpires=Y;;__47__lastLogon=200510
27125629;;__... etc... etc"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top