Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 9th, 2005, 05:54 AM
Authorized User
 
Join Date: Dec 2004
Location: Belfast, Antrim, United Kingdom.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Capitals

HI all

Does anyone know a quick way of accepting text in a textbox and forcing the text to be written in capitals into a specified table?



Cheers
Tony
__________________
Cheers
Tony
 
Old March 9th, 2005, 10:05 AM
Friend of Wrox
 
Join Date: Nov 2004
Location: Seattle, WA, .
Posts: 248
Thanks: 0
Thanked 1 Time in 1 Post
Default

In the AfterUpdate event of the field

field = UCase(field)

Randall J Weers
Membership Vice President
Pacific NorthWest Access Developers Group
http://www.pnwadg.org
 
Old March 9th, 2005, 11:40 AM
Authorized User
 
Join Date: Dec 2004
Location: Belfast, Antrim, United Kingdom.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Brilliant...cheers

Cheers
Tony
 
Old March 9th, 2005, 04:34 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default


Code:
    field = UCase$(field)
is better than
Code:
    field = UCase(field)
UCase$() receives a string, and returns a String. UCase() uses Variants, and is therefore just a tad slower.
 
Old March 9th, 2005, 11:41 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Seattle, WA, .
Posts: 248
Thanks: 0
Thanked 1 Time in 1 Post
Default

UCase$ may be faster. However, you will need to see if the field is null before you UCase$ it. Or

  field = UCase$(nz(field))

But then does the overhead of nz cancel out the benefit of UCase$?

Plus you'll store an empty string in the database. Not always the same as Null.

I figure for a data entry field UCase or UCase$... six of one, half a dozen of the other.

Randall J Weers
Membership Vice President
Pacific NorthWest Access Developers Group
http://www.pnwadg.org
 
Old March 10th, 2005, 01:10 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

So if you pass a Null to UCase() it returns a Null?

That would be a significant advantage in many instances...




Similar Threads
Thread Thread Starter Forum Replies Last Post
Access DB using VB to select msgs with capitals akb786 Access 36 May 23rd, 2005 07:44 AM
Chap 5 capitals.ph (array syntax) growch BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 6 October 31st, 2003 12:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.