[AccessD] Comparing strings

JWColby jwcolby at colbyconsulting.com
Sun Jan 14 14:51:04 CST 2007


Yea, I can do something like that.  I was hoping for a built-in syntax. 


John W. Colby
Colby Consulting
www.ColbyConsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte
Sent: Friday, January 12, 2007 3:41 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Comparing strings

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