473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Uppercase to Mixed Case Edit in Field

I have a table where a few of the users entered vendor names ALL IN
UPPER CASE. I have created forms to edit the data, but I can't seem to
allow changing JOE SMITH to Joe Smith.

What to I have to do to have the user change the name, but keep the
key? Overall, I think any "edits" simply add a new record, rather than
change the existing record.

The form is simple - Choose the vendor from the drop-down list.
After Update, a new field displays: Vendor: [and the chosen vendor in
the field]

If the user wishes to Add a new vendor or Delete the current one, they
choose a button on the bottom of the screen and that works just fine.

The "edit" or "Change" is what doesn't work.

Don't know what code to post, so I didn't post any.

Thanks.

Sara

Aug 8 '06 #1
8 6374
This will force the name into "Joe Smith"
Add it to the field under the afterupdate property.
Private Sub FirstName_AfterUpdate()

Me.FirstName = StrConv(FirstName, 3) ' Research StrConv Function for
more info on number to use

End Sub

Private Sub LastName_AfterUpdate()

Me.LastName = StrConv(LastName, 3) ' Research StrConv Function for
more info on number to use

End Sub

Private Sub MiddleInitial_AfterUpdate()

Me.MiddleInitial = StrConv(MiddleInitial, 3) ' Research StrConv
Function for more info on number to use

End Sub


Some code that will capitalize the first letter but not force the rest
of the letters to be lowercase.

Here it is:

Private Sub LastName_AfterUpdate()

Dim strFirstLetter As String

Dim strRightName As String

Dim strWholeName As String

strFirstLetter = Left(LastName, 1)

strRightName = Mid(LastName, 2, 49)

strWholeName = UCase(strFirstLetter) + strRightName

Me.LastName = strWholeName

End Sub

sara wrote:
I have a table where a few of the users entered vendor names ALL IN
UPPER CASE. I have created forms to edit the data, but I can't seem to
allow changing JOE SMITH to Joe Smith.

What to I have to do to have the user change the name, but keep the
key? Overall, I think any "edits" simply add a new record, rather than
change the existing record.

The form is simple - Choose the vendor from the drop-down list.
After Update, a new field displays: Vendor: [and the chosen vendor in
the field]

If the user wishes to Add a new vendor or Delete the current one, they
choose a button on the bottom of the screen and that works just fine.

The "edit" or "Change" is what doesn't work.

Don't know what code to post, so I didn't post any.

Thanks.

Sara
Aug 8 '06 #2
Thanks, gumby. Maybe I'm not being clear.

I have 2 problems:

1. The field is ONE field: Vendor. It may have a company name (ABC
Corp) or it may have a person's name (JOE SMITH). I want to end up
with [ABC Corp] and [Joe Smith] by allowing the user to edit.

2. Every time I try to change, the system tells me I'm trying to add a
duplicate record. I want to change JOE SMITH to Joe Smith, so I'm not
even sure the after update code is the right thing to do.

Here's the code I wrote, and it does execute, but I get a dup message
(I don't allow the same vendor name to be added).

Private Sub txtVendor_AfterUpdate()
' This will force "JOE SMITH" into "Joe SMITH"

Dim strVendor As String
Dim strFirstLetter As String
Dim strRightName As String
Dim strWholeName As String

strVendor = Me.txtVendor
strFirstLetter = Left(strVendor, 1)
strRightName = Mid(strVendor, 2, 49)
strWholeName = UCase(strFirstLetter) + strRightName
Me.txtVendor = strWholeName
End Sub

Thanks

Sara



gumby wrote:
This will force the name into "Joe Smith"
Add it to the field under the afterupdate property.
Private Sub FirstName_AfterUpdate()

Me.FirstName = StrConv(FirstName, 3) ' Research StrConv Function for
more info on number to use

End Sub

Private Sub LastName_AfterUpdate()

Me.LastName = StrConv(LastName, 3) ' Research StrConv Function for
more info on number to use

End Sub

Private Sub MiddleInitial_AfterUpdate()

Me.MiddleInitial = StrConv(MiddleInitial, 3) ' Research StrConv
Function for more info on number to use

End Sub


Some code that will capitalize the first letter but not force the rest
of the letters to be lowercase.

Here it is:

Private Sub LastName_AfterUpdate()

Dim strFirstLetter As String

Dim strRightName As String

Dim strWholeName As String

strFirstLetter = Left(LastName, 1)

strRightName = Mid(LastName, 2, 49)

strWholeName = UCase(strFirstLetter) + strRightName

Me.LastName = strWholeName

End Sub

sara wrote:
I have a table where a few of the users entered vendor names ALL IN
UPPER CASE. I have created forms to edit the data, but I can't seem to
allow changing JOE SMITH to Joe Smith.

What to I have to do to have the user change the name, but keep the
key? Overall, I think any "edits" simply add a new record, rather than
change the existing record.

The form is simple - Choose the vendor from the drop-down list.
After Update, a new field displays: Vendor: [and the chosen vendor in
the field]

If the user wishes to Add a new vendor or Delete the current one, they
choose a button on the bottom of the screen and that works just fine.

The "edit" or "Change" is what doesn't work.

Don't know what code to post, so I didn't post any.

Thanks.

Sara
Aug 8 '06 #3
Wait, you didn't use the vendor's actual name as a primary key, did
you? BAD design. Very bad. I mean, how many Smiths are in the phone
book? That's just asking for trouble. Your first relationship will
work okay, but what happens when you really do have a second "John
Smith". Make the primary key an autonumber, and then base the
relationships on that. If you want to convert the text to propercase,
use something like this:

?strconv("david ortiz",vbProperCase)
David Ortiz

Of course, if you have exceptions to the "first letter capitalized"
rule, you're SOL.

Aug 9 '06 #4
No, I did not use the vendor's name as a key, but I did set a unique
index. The table is simple: VendorKey (autonumber), VendorName and
VendorStatus (Active or Deleted).

We do not have the same vendor name twice (haven't in almost 50
years), and even if we somehow did, we'd have to give it a unique name
so the executives would know which vendor sold us which items. They
get reports by vendor name.

SO, the problem still remains that I am not doing what is necessary to
update a record, but rather have (somehow) set it up so that every
action on the screen is seen by the system as a new record, not an
update.

We do have exceptions to the first letter Cap rule, as I mentioned -
ABC Corp, for example, needs to be ABC Corp (not Abc Corp), but Joe
Smith shouldn't be JOE SMITH. The users have to decide what should be
caps and what shouldn't and enter the name properly when they set up
any new vendors (which is rarely).

Now, however, we have over 1000 vendors, and many are all caps. I'm
trying to figure out how to allow editing to simply change the case to
be what we have agreed upon, but the system sees it as a new record,
with the same value.

Any thoughts? Anyone?

thanks
Sara
pi********@hotmail.com wrote:
Wait, you didn't use the vendor's actual name as a primary key, did
you? BAD design. Very bad. I mean, how many Smiths are in the phone
book? That's just asking for trouble. Your first relationship will
work okay, but what happens when you really do have a second "John
Smith". Make the primary key an autonumber, and then base the
relationships on that. If you want to convert the text to propercase,
use something like this:

?strconv("david ortiz",vbProperCase)
David Ortiz

Of course, if you have exceptions to the "first letter capitalized"
rule, you're SOL.
Aug 9 '06 #5
"sara" <sa*******@yahoo.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
I have a table where a few of the users entered vendor names ALL IN
UPPER CASE. I have created forms to edit the data, but I can't seem to
allow changing JOE SMITH to Joe Smith.

What to I have to do to have the user change the name, but keep the
key? Overall, I think any "edits" simply add a new record, rather than
change the existing record.

The form is simple - Choose the vendor from the drop-down list.
After Update, a new field displays: Vendor: [and the chosen vendor in
the field]

If the user wishes to Add a new vendor or Delete the current one, they
choose a button on the bottom of the screen and that works just fine.

The "edit" or "Change" is what doesn't work.

Don't know what code to post, so I didn't post any.

Thanks.

Sara
If the control on the form is bound and unlocked, then the users should be
able to change it. But I suspect that you have it locked so nobody
accidently changes it. Am I correct?
If so, then unlock the control and put the following code in the
BeforeUpdate Event:

'''(CAUTION - air code)
' If the user only changes the case of the characters then old & new values
will match
If Me.VendorName <Me.VendorName.OldValue Then
Msgbox "You attempted to change the vendor name"
Cancel = True
Me.Undo
Exit Sub
Endif

Good Luck,
Fred Zuckerman
Aug 9 '06 #6
2 Questions, Fred:

1. The control is bound to field Vendor, and named txtVendor. It is
unlocked. Does it matter if it is showing in the combo box where the
user selected the vendor in the first place? The cboVendor is bound
inm column 1 to vendor key, but I do display the field Vendor. Should
I blank that out? Does it matter?

2. I want the user to change the case, not the value. Will the <>
allow case change, but not value?

I thought this was going to be SO easy!!! Was I ever wrong!

Thanks for the help.
Sara
Fred Zuckerman wrote:
"sara" <sa*******@yahoo.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
I have a table where a few of the users entered vendor names ALL IN
UPPER CASE. I have created forms to edit the data, but I can't seem to
allow changing JOE SMITH to Joe Smith.

What to I have to do to have the user change the name, but keep the
key? Overall, I think any "edits" simply add a new record, rather than
change the existing record.

The form is simple - Choose the vendor from the drop-down list.
After Update, a new field displays: Vendor: [and the chosen vendor in
the field]

If the user wishes to Add a new vendor or Delete the current one, they
choose a button on the bottom of the screen and that works just fine.

The "edit" or "Change" is what doesn't work.

Don't know what code to post, so I didn't post any.

Thanks.

Sara

If the control on the form is bound and unlocked, then the users should be
able to change it. But I suspect that you have it locked so nobody
accidently changes it. Am I correct?
If so, then unlock the control and put the following code in the
BeforeUpdate Event:

'''(CAUTION - air code)
' If the user only changes the case of the characters then old & new values
will match
If Me.VendorName <Me.VendorName.OldValue Then
Msgbox "You attempted to change the vendor name"
Cancel = True
Me.Undo
Exit Sub
Endif

Good Luck,
Fred Zuckerman
Aug 10 '06 #7
I'm sorry I don't understand the setup. You have a combo control AND a text
control, and they're both displaying the Vendor field?

Anyway, in answer to your 2nd question, the <(not equal) operator is
opposite of the = (equal) operator. The statement of "Jones" <"JONES" is
false. So using the <operator to cancel, will allow users to change case
without changing the value.

Good Luck,
Fred Zuckerman
"sara" <sa*******@yahoo.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
2 Questions, Fred:

1. The control is bound to field Vendor, and named txtVendor. It is
unlocked. Does it matter if it is showing in the combo box where the
user selected the vendor in the first place? The cboVendor is bound
inm column 1 to vendor key, but I do display the field Vendor. Should
I blank that out? Does it matter?

2. I want the user to change the case, not the value. Will the <>
allow case change, but not value?

I thought this was going to be SO easy!!! Was I ever wrong!

Thanks for the help.
Sara
Fred Zuckerman wrote:
"sara" <sa*******@yahoo.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
I have a table where a few of the users entered vendor names ALL IN
UPPER CASE. I have created forms to edit the data, but I can't seem
to
allow changing JOE SMITH to Joe Smith.
>
What to I have to do to have the user change the name, but keep the
key? Overall, I think any "edits" simply add a new record, rather
than
change the existing record.
>
The form is simple - Choose the vendor from the drop-down list.
After Update, a new field displays: Vendor: [and the chosen vendor
in
the field]
>
If the user wishes to Add a new vendor or Delete the current one, they
choose a button on the bottom of the screen and that works just fine.
>
The "edit" or "Change" is what doesn't work.
>
Don't know what code to post, so I didn't post any.
>
Thanks.
>
Sara
If the control on the form is bound and unlocked, then the users should
be
able to change it. But I suspect that you have it locked so nobody
accidently changes it. Am I correct?
If so, then unlock the control and put the following code in the
BeforeUpdate Event:

'''(CAUTION - air code)
' If the user only changes the case of the characters then old & new
values
will match
If Me.VendorName <Me.VendorName.OldValue Then
Msgbox "You attempted to change the vendor name"
Cancel = True
Me.Undo
Exit Sub
Endif

Good Luck,
Fred Zuckerman


Aug 10 '06 #8
I got it! Now I can edit and change case and it keeps the same key.

The set up: I have the user choose a vendor from the drop-down list.
This is for editing, or so they can first make sure the vendor isn't in
the list before they go and add it (to prevent duplicates). I wasn't
setting the combo box to blank in the AfterUpdate event - I just
display the name field for editing.
Thanks
sara

Fred Zuckerman wrote:
I'm sorry I don't understand the setup. You have a combo control AND a text
control, and they're both displaying the Vendor field?

Anyway, in answer to your 2nd question, the <(not equal) operator is
opposite of the = (equal) operator. The statement of "Jones" <"JONES" is
false. So using the <operator to cancel, will allow users to change case
without changing the value.

Good Luck,
Fred Zuckerman
"sara" <sa*******@yahoo.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
2 Questions, Fred:

1. The control is bound to field Vendor, and named txtVendor. It is
unlocked. Does it matter if it is showing in the combo box where the
user selected the vendor in the first place? The cboVendor is bound
inm column 1 to vendor key, but I do display the field Vendor. Should
I blank that out? Does it matter?

2. I want the user to change the case, not the value. Will the <>
allow case change, but not value?

I thought this was going to be SO easy!!! Was I ever wrong!

Thanks for the help.
Sara
Fred Zuckerman wrote:
"sara" <sa*******@yahoo.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
I have a table where a few of the users entered vendor names ALL IN
UPPER CASE. I have created forms to edit the data, but I can't seem
to
allow changing JOE SMITH to Joe Smith.

What to I have to do to have the user change the name, but keep the
key? Overall, I think any "edits" simply add a new record, rather
than
change the existing record.

The form is simple - Choose the vendor from the drop-down list.
After Update, a new field displays: Vendor: [and the chosen vendor
in
the field]

If the user wishes to Add a new vendor or Delete the current one, they
choose a button on the bottom of the screen and that works just fine.

The "edit" or "Change" is what doesn't work.

Don't know what code to post, so I didn't post any.

Thanks.

Sara
>
If the control on the form is bound and unlocked, then the users should
be
able to change it. But I suspect that you have it locked so nobody
accidently changes it. Am I correct?
If so, then unlock the control and put the following code in the
BeforeUpdate Event:
>
'''(CAUTION - air code)
' If the user only changes the case of the characters then old & new
values
will match
If Me.VendorName <Me.VendorName.OldValue Then
Msgbox "You attempted to change the vendor name"
Cancel = True
Me.Undo
Exit Sub
Endif
>
Good Luck,
Fred Zuckerman
Aug 11 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Vangelis Natsios | last post by:
I'm trying to provide a case-insensitive search in greek texts from a jsp page. The check goes like this: if (el_title.toUpperCase().indexOf(selected_title.toUpperCase()) { .... } where...
23
by: Hallvard B Furuseth | last post by:
Has someone got a Python routine or module which converts Unicode strings to lowercase (or uppercase)? What I actually need to do is to compare a number of strings in a case-insensitive manner,...
3
by: Fernand St-Georges | last post by:
How can I create a trigger that obliges UPPERCASE of a field in the database? thanks
1
by: The_Kingpin | last post by:
Hi all, I need to make a function that convert a string into a certain format. Here what are the restriction: -The first letter of the first and last name must be uppercase. -If a first name...
1
by: Randy Fraser | last post by:
Could someone tell me how I can force uppercase characters in a TextBox column in a datagrid? Thanks Randy
5
by: Todd Snyder | last post by:
I need to make a field put uppercase letters in it when a lowercase letter is entered into that field. Is there an expression to use or does it have to be written in code? *** Sent via...
6
by: feeman | last post by:
I can change a field to upper case by using the after event function and the following code Me. = UCase(Me.) But how can you do it so that the whole form will change to Uppercase, there are...
7
by: =?Utf-8?B?SmltIFdhbHNo?= | last post by:
I'm new to working with mixed assemblies. All of my previous experience has been with VC++/MFC in native, unmanaged applications. When I create a mixed assembly in which one or more of the files...
3
by: =?Utf-8?B?Sm9zZXBo?= | last post by:
Hi all, I'd like to know how to force uppercase characters in an ASP.Net web form text field. Thanks
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.