Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Developer Toolkits / September 2007

Tip: Looking for answers? Try searching our database.

mixed cases words help required!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
riccifs@tin.it - 21 Sep 2007 08:55 GMT
Hi to everyone in the Newsgroup,

I have a question that I really don't known how to solve.
To handle names with mixed cases, on my form, I'm using the code I
found at this web-link: http://www.mvps.org/access/strings/str0008.htm
Of course, it works great and as I read it should be modular so that
it possible to add additional rules to handle special sequences of
characters.

What I'd like to do is to add a piece of code, to be able to
transform the string ''spa'' in ''S.p.A.''
My trouble is that any time I have to write S.p.A. and I do that
hundred of
times, I have to remember to hit the point key after each letters and
at
same time I have to mind the different case of each characters .
It will be great if it doesn't matter how I to write ''spa'', the code
would change it in ''S.p.A.'' for me.
Looking the last part of the code there is a function to handle
roman numbers. So any time you write ''vii'' the code will change in
''VII'' for
you.
Is possible to do something like that for my sequences of words?
I'm not absolutely able to that, so I'm asking for help.
The words I'd like to be able to handle are: S.r.l. S.p.A. s.n.c.
s.a.s. S.r.l.u.
They are often (not always) located at the end of any strings

I hope you will be give to me an hand.....!
Thanks,
Stefano.
Klatuu - 21 Sep 2007 15:34 GMT
You can use the Before Update event of the control to do this.  The only
drawback is whether the possibility exists that the entered text could
contain the string spa that should not be transformed, but you will have to
deal with that.

Private Sub txtSomeControl_BeforeUpdate(Cancel As Integer)

   If Instr(Me.txtSomeControl, "spa") > 0 Then
       Me.txtSomeControl = Replace(Me.txtSomeControl,"spa", "S.p.A.")
   ElseIf Instr(Me.txtSomeControl, "srl") > 0 Then
       Me.txtSomeControl = Replace(Me.txtSomeControl,"srl", "S.r.L.")
   ElseIf Instr(Me.txtSomeControl, "snc") > 0 Then
       Me.txtSomeControl = Replace(Me.txtSomeControl,"srl", "s.n.c.")
   End If
End Sub

Add whatever other values you need to convert.
Signature

Dave Hargis, Microsoft Access MVP

> Hi to everyone in the Newsgroup,
>
[quoted text clipped - 27 lines]
> Thanks,
> Stefano.
Jeff Boyce - 21 Sep 2007 23:12 GMT
A minor detail/typo, I suspect...

I think the third replace needs to replace "snc" rather than "srl".  Drat
that Copy/Paste <g>!

Jeff Boyce

> You can use the Before Update event of the control to do this.  The only
> drawback is whether the possibility exists that the entered text could
[quoted text clipped - 46 lines]
>> Thanks,
>> Stefano.
riccifs@tin.it - 22 Sep 2007 08:24 GMT
> A minor detail/typo, I suspect...
>
[quoted text clipped - 57 lines]
> >> Thanks,
> >> Stefano.

Hi Jeff,
many thanks to have answered me, but I'm still not understanding very
well what I have to do.
Could you give to me more instructions on how to do, please?

Bye,
Stefano.

P.S.
I'm not very good VBA code builder, so I need a step by step help!
Jeff Boyce - 24 Sep 2007 23:02 GMT
Stefano

What Dave suggested is to add an event procedure to the Before Update event
of the text control on your form in which the users will be entering the
codes.  If you don't have any experience creating (and troubleshooting!)
VBA, it could be a bit of a learning curve.

Fortunately, you can copy and paste his code, making changes appropriate to
the names of your objects.

Potentially, another approach might be to create a table that hold two
fields.  One field is the abbreviation, the other is the description.  Then
you could use a combo box on your form to let the users select what they
need to use, rather than having to enter something (and have you, via code,
have to modify it).

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP

>> A minor detail/typo, I suspect...
>>
[quoted text clipped - 70 lines]
> P.S.
> I'm not very good VBA code builder, so I need a step by step help!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.