Capital

Z

Zanstemic

I'm using the vbProperCase to make the First Name and Last Name capital,
however, they have added the requirement to have a "NA" and "SAME" selection
which remains in all caps.

Currently the vpProperCase turn the "NA" into "Na" and the "SAME" into "Same"

Any suggestions is greatly appreciated.
 
J

Jeff Boyce

If you are using an Update Query to change the capitalization, you could
include a selection criterion that excludes "NA" and "SAME".

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Z

Zanstemic

This is the current Event Procedure in After Update


Me![txtName] = StrConv([txtName], vbProperCase)

I'm not sure how to setup the selection criterion.

Can you lead me in the right direction?

Thanks Jeff
 
A

Alex Dybenko

Hi,
try this:

select case Me![txtName]
case "na", "same"
Me![txtName] = ucase([txtName])
case else
Me![txtName] = StrConv([txtName], vbProperCase)
end select

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com

Zanstemic said:
This is the current Event Procedure in After Update


Me![txtName] = StrConv([txtName], vbProperCase)

I'm not sure how to setup the selection criterion.

Can you lead me in the right direction?

Thanks Jeff

Jeff Boyce said:
If you are using an Update Query to change the capitalization, you could
include a selection criterion that excludes "NA" and "SAME".

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

John Spencer

Try the following

IF Me.txtName = "NA" or Me.txtName="SAME" Then
'Do nothing
ELSE
Me.[txtName] = StrConv(Me.[txtName], vbProperCase)
END IF

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
This is the current Event Procedure in After Update


Me![txtName] = StrConv([txtName], vbProperCase)

I'm not sure how to setup the selection criterion.

Can you lead me in the right direction?

Thanks Jeff

Jeff Boyce said:
If you are using an Update Query to change the capitalization, you could
include a selection criterion that excludes "NA" and "SAME".

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Z

Zanstemic

Code worked perfectly. Impressive!!!

Alex Dybenko said:
Hi,
try this:

select case Me![txtName]
case "na", "same"
Me![txtName] = ucase([txtName])
case else
Me![txtName] = StrConv([txtName], vbProperCase)
end select

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com

Zanstemic said:
This is the current Event Procedure in After Update


Me![txtName] = StrConv([txtName], vbProperCase)

I'm not sure how to setup the selection criterion.

Can you lead me in the right direction?

Thanks Jeff

Jeff Boyce said:
If you are using an Update Query to change the capitalization, you could
include a selection criterion that excludes "NA" and "SAME".

Regards

Jeff Boyce
Microsoft Office/Access MVP

I'm using the vbProperCase to make the First Name and Last Name
capital,
however, they have added the requirement to have a "NA" and "SAME"
selection
which remains in all caps.

Currently the vpProperCase turn the "NA" into "Na" and the "SAME" into
"Same"

Any suggestions is greatly appreciated.
 
J

Jeff Boyce

In a query, for the Selection Criterion, <>"NA" And <> "SAME"

Regards

Jeff Boyce
Microsoft Office/Access MVP

Zanstemic said:
This is the current Event Procedure in After Update


Me![txtName] = StrConv([txtName], vbProperCase)

I'm not sure how to setup the selection criterion.

Can you lead me in the right direction?

Thanks Jeff

Jeff Boyce said:
If you are using an Update Query to change the capitalization, you could
include a selection criterion that excludes "NA" and "SAME".

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Z

Zanstemic

In testing the code, a new request has been added:

When using a hyphen in a last name and also for apartment numbers in an
address

Here are the examples
Smith-Smith currently it is coming out as Smith-smith
Apt. 7A is currently coming out as 7a

Any suggestions are appreciated.

Alex Dybenko said:
Hi,
try this:

select case Me![txtName]
case "na", "same"
Me![txtName] = ucase([txtName])
case else
Me![txtName] = StrConv([txtName], vbProperCase)
end select

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com

Zanstemic said:
This is the current Event Procedure in After Update


Me![txtName] = StrConv([txtName], vbProperCase)

I'm not sure how to setup the selection criterion.

Can you lead me in the right direction?

Thanks Jeff

Jeff Boyce said:
If you are using an Update Query to change the capitalization, you could
include a selection criterion that excludes "NA" and "SAME".

Regards

Jeff Boyce
Microsoft Office/Access MVP

I'm using the vbProperCase to make the First Name and Last Name
capital,
however, they have added the requirement to have a "NA" and "SAME"
selection
which remains in all caps.

Currently the vpProperCase turn the "NA" into "Na" and the "SAME" into
"Same"

Any suggestions is greatly appreciated.
 
J

John W. Vinson

In testing the code, a new request has been added:

When using a hyphen in a last name and also for apartment numbers in an
address

Here are the examples
Smith-Smith currently it is coming out as Smith-smith
Apt. 7A is currently coming out as 7a

This kind of thing often requires a USB interface... Using Someone's Brain.

What most of my apps do is only apply the StrConv() update if the input text
is in all lower case:

If strComp(Me!txtLastName, LCase(Me!txtLastName), 0) = 0 Then
Me!txtLastName = StrConv(Me!txtLastName, vbProperCase)
End If

in VBA code in a form, or

IIF(strComp([LastName], LCase(LastName), 0) = 0, StrConv(LastName, 3),
[LastName])

in an Update query. This does require that users enter such data with the
actual use of their little fingers on the Shift key, and will run into trouble
if they try to enter e. e. cummings or Archie and Mehitabel poems, but...
 
L

Linq Adams via AccessMonster.com

The apartment number should really be in a separate field from the street
address, which would make the question moot.

Exactly what code are you currently using for the name, which I assume is all
in one field?

And while we're on names, it hasn't come up yest, but given the trend here,
it'ds bound to; what are you going to do about names like

Thuston Howell III ?

Using

Me.[txtName] = StrConv(Me.[txtName], vbProperCase)

it'll come out

Thuston Howell Iii
 
Z

Zanstemic

Regarding the code: The name field and address fields are different and are
using the same approach. Here is the current code

Private Sub txtNameInsured_AfterUpdate()

Select Case Me![txtAddress]
Case "N/A", "S/A"
Me![txtAddress] = UCase([txtAddrss])

Case Else
Me![txtAddress] = StrConv([txtAddress], vbProperCase)
End Select

End Sub

Thanks in advance for the suggestions.
 
L

Linq Adams via AccessMonster.com

Now I'm really confused! Your code just posted shows you using the AfterUdate
of your name textbox to change the formatting of your address field, is that
right?
 
L

Linq Adams via AccessMonster.com

Assuming that you mean to change the formatting of your ***txtNameInsured***
in its AfterUpdate event, then

Private Sub txtNameInsured_AfterUpdate()

If InStr(Me.txtNameInsured, "-") > 0 Then
Component1 = Left(Me.txtNameInsured, InStr(Me.txtNameInsured, "-"))
Component2 = Right(Me.txtNameInsured, Len(Me.txtNameInsured) - InStr(Me.
txtNameInsured, "-"))
Me.txtNameInsured = StrConv(Component1, vbProperCase) & StrConv(Component2,
vbProperCase)
Exit Sub
End If

Select Case Me![txtNameInsured]
Case "N/A", "S/A"
Me![txtNameInsured] = UCase([txtNameInsured])
Case Else
Me![txtNameInsured] = StrConv([txtNameInsured], vbProperCase)
End Select

End Sub

should do the job.
 
Top