[AccessD] Asterix

Tony Septav TSeptav at uniserve.com
Mon Feb 27 12:33:11 CST 2012


Hey Mike
Then show me. As mentioned that wasn't rocket science. Always willing to
learn something new. And as we all know there are many different ways to
approach a problem, some much better than others.

A clever person solves a problem. A wise person avoids it.
Albert Einstein.

Tony Septav
Nanaimo, BC
Canada

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Michael Bahr
Sent: Monday, February 27, 2012 9:25 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Asterix

This is painful and inflexiable as with using the left, mid, right
functions.  Yes they work but they are rather static and for one string
pattern.  Using regular-expressions would reduce this to just a few lines
and be very flexiable and cover a wide range of patterns.  The only problem
is learning regular-expressions but then, once you learn it you will wonder
why you did not do so before.  :-)

Mike

> Hey All
> Some code that may help. Didn't want to try writing tons of code for 
> all the reserved words, so I use this code, nothing fancy by any means 
> but it seems to be working fine. Except for multiple asterixs. Search 
> for everything containing *** and it returns **a, ***b, ****d, *e*, 
> ***f*** etc. Not a biggy because I can see the asterixs. Also I am 
> getting tired of fooling around with this thing.
>
> If Mysearch=1 ..........Starts With
> If Len(Me!MyPhrase = 1 Then
>     Zimbo = "[" & Left(Me!MyPhrase, 1) & "]" & "*"
> Else
>     If Len(Me!MyPhrase) = 2 Then
>         Zimbo = "[" & Left(Me!MyPhrase, 1) & "]" & "[" & 
> right(Me!MyPhrase,
> 1) & "*"
>     Else
>         Zimbo =  "[" & Left(Me!MyPhrase, 1) & "]" & Mid(Me!MyPhrase, 2,
> Len(Mid(Me!        MyPhrase,    2)) - 1) & "[" & Right(Me!MyPhrase, 1) &
> "]"
> & "*"
> else .........Contains
> If Len(Me!MyPhrase = 1 Then
>     Zimbo ="* & "[" & Left(Me!MyPhrase, 1) & "]" & "*"
> Else
>     If Len(Me!MyPhrase) = 2 Then
>         Zimbo ="*" & "[" & Left(Me!MyPhrase, 1) & "]" & "[" & 
> right(Me!MyPhrase, 1) & "*"
>     Else
>         Zimbo ="*" &  "[" & Left(Me!MyPhrase, 1) & "]" & 
> Mid(Me!MyPhrase, 2,
> Len(Mid(Me!MyPhrase,    2)) - 1) & "[" & Right(Me!MyPhrase, 1) & "]" & "*"
>
> End If
> MyWord = Zimbo
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.1913 / Virus Database: 2114/4835 - Release Date: 02/27/12



More information about the AccessD mailing list