473,749 Members | 2,394 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6394
This will force the name into "Joe Smith"
Add it to the field under the afterupdate property.
Private Sub FirstName_After Update()

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

End Sub

Private Sub LastName_AfterU pdate()

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

End Sub

Private Sub MiddleInitial_A fterUpdate()

Me.MiddleInitia l = StrConv(MiddleI nitial, 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_AfterU pdate()

Dim strFirstLetter As String

Dim strRightName As String

Dim strWholeName As String

strFirstLetter = Left(LastName, 1)

strRightName = Mid(LastName, 2, 49)

strWholeName = UCase(strFirstL etter) + 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_After Update()
' 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(strFirstL etter) + 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_After Update()

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

End Sub

Private Sub LastName_AfterU pdate()

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

End Sub

Private Sub MiddleInitial_A fterUpdate()

Me.MiddleInitia l = StrConv(MiddleI nitial, 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_AfterU pdate()

Dim strFirstLetter As String

Dim strRightName As String

Dim strWholeName As String

strFirstLetter = Left(LastName, 1)

strRightName = Mid(LastName, 2, 49)

strWholeName = UCase(strFirstL etter) + 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",vbProper Case)
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********@hotm ail.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",vbProper Case)
David Ortiz

Of course, if you have exceptions to the "first letter capitalized"
rule, you're SOL.
Aug 9 '06 #5
"sara" <sa*******@yaho o.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.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*******@yaho o.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.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*******@yaho o.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.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*******@yaho o.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.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*******@yaho o.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.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*******@yaho o.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.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
7915
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 selected_title is the value of a field from the search form and el_title is the value retrieved from the database. The problem is that some of the greek characters, namely those with tonos (accent) or
23
25942
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, so I assume it's simplest to convert to lower/upper first. Possibly all strings will be from the latin-1 character set, so I could convert to 8-bit latin-1, map to lowercase, and convert back, but that seems rather cumbersome.
3
9576
by: Fernand St-Georges | last post by:
How can I create a trigger that obliges UPPERCASE of a field in the database? thanks
1
3264
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 contains only 1 character, a '.' must follow the char. -If we find a character that isn't a letter (.&*-), we must swap it for a '/' and add the correct spaces. I tried making a function but my switch seems to have an error. If anyone
1
1533
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
3606
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 Developersdex http://www.developersdex.com ***
6
9892
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 20 fields on this form, and I would have to do the above for all of them. There must be a faster way. Anybody know the answer
7
4805
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 compiles with /clr the instructions say that I need to change the switch for Debug information format from Program Database for Edit & Continue to disabled. At runtime I find that I am not able to set breakpoints in the managed code, nor trace...
3
3672
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
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9388
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9333
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8256
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.