[AccessD] Comparing strings

Mark A Matte markamatte at hotmail.com
Fri Jan 12 14:40:39 CST 2007


John,

If I understand your question...in this example Text1 and Text2 are 
textboxes.  This may do what you need:

Dim T1 'length of Text1
Dim CP 'Current Position
T1 = Len(Me!Text1)
CP = 0
Do Until CP > T1
    CP = CP + 1
    If Left(Me!Text1, CP) = Left(Me!Text2, CP) Then
    Else
        MsgBox "The first difference between text1 and text2 is in position 
" & CP
        Exit Sub
    End If
Loop

MsgBox "Text1 and Text2 are the same"

Hope it helps.

Mark A. Matte

>From: "JWColby" <jwcolby at colbyconsulting.com>
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: "'Access Developers discussion and problem 
>solving'"<accessd at databaseadvisors.com>
>Subject: [AccessD] Comparing strings
>Date: Fri, 12 Jan 2007 14:17:15 -0500
>
>Is there a syntax in VBA for showing the position of the first difference
>between two strings?
>
>John W. Colby
>Colby Consulting
>www.ColbyConsulting.com
>
>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com

_________________________________________________________________
Type your favorite song.  Get a customized station.  Try MSN Radio powered 
by Pandora. http://radio.msn.com/?icid=T002MSN03A07001




More information about the AccessD mailing list