I used to use a piece of VBA code in the After Update event to force proper case in an Access field eg. LastName (this worked in the Access 2003 database)
Private Sub LastName_AfterUpdate()
Me.LastName = StrConv(Me.LastName, vbProperCase)
End Sub
It's no longer working in Access 2007 (a new db, not converted).
I also seem to remember a piece of SQL code that worked as well...it went something like:
docmd.(my SQL Statement) and a 3 was involved to describe Proper Case...but can't remember how that went either, but remember applying it I think to a line in my Lookup tab (possibly the source line) for that fields properties...I don't recall its been so long.
Anyway...
How can I force Proper Case in a field for example called LastName within the form in Access 2007. Has anyone else had a problem with this not working in Access 2007.
Thanks ahead for any help on this.
Proper Case in an Access 2007 Form
-
- 2StarLounger
- Posts: 170
- Joined: 05 Feb 2010, 18:04
- Location: Jacksonville, NC
Proper Case in an Access 2007 Form
If you can't convince them, confuse them - Harry S. Truman
Nannette
Nannette
-
- 2StarLounger
- Posts: 112
- Joined: 25 Jan 2010, 20:19
Re: Proper Case in an Access 2007 Form
Code: Select all
Private Sub LastName_AfterUpdate()
Me.LastName = StrConv(Me.LastName, vbProperCase)
End Sub
-
- Administrator
- Posts: 78485
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Proper Case in an Access 2007 Form
The After Update code works correctly for me too in Access 2007. In what sense doesn't it work for you?
- You get an error message - if so, what does it say?
- It doesn't do anything.
- It does something different from what you intended - if so, what?
Have you checked for missing references in Tools | References in the Visual Basic Editor?
- You get an error message - if so, what does it say?
- It doesn't do anything.
- It does something different from what you intended - if so, what?
Have you checked for missing references in Tools | References in the Visual Basic Editor?
Best wishes,
Hans
Hans
-
- NewLounger
- Posts: 18
- Joined: 24 Feb 2010, 20:38
- Location: Chelsea, Greater London, England
Re: Proper Case in an Access 2007 Form
Have you checked that macros are enabled or that the db is in a Trusted Location?
Access/Excel Dabbler
Windows XP SP3/Windows 7/O2K/O2007
Windows XP SP3/Windows 7/O2K/O2007
-
- Administrator
- Posts: 78485
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Proper Case in an Access 2007 Form
Steve has a very good point. See Enable or disable macros in Office documents for more details.
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 170
- Joined: 05 Feb 2010, 18:04
- Location: Jacksonville, NC
Re: Proper Case in an Access 2007 Form
I have tried it at work, instead of at home, and it seems to work just fine here. I did take the extra step and place the db as a trusted source. It could have been the step that disallowed it to work.
Thanks everyone. I'm good to go on this!
Thanks everyone. I'm good to go on this!
If you can't convince them, confuse them - Harry S. Truman
Nannette
Nannette