One more time capital letters....

carphatian

Registered User.
Local time
Today, 12:55
Joined
Feb 9, 2009
Messages
12
Need help again...

To make it simple I do have a table with CompanyID and Company Name.

I do have a combo box in a form which is bounded to CompanyID. The data source of the combobox is actually a query which contains Company ID and Company name. The box as I said is bounded to CompanyID but visible is only the Company name.

When the user types a company which is not in the list it triggers to open a new form which will capture the text the user typed, ask for more data and save everything in the Company table.

Is it possible to get the text which user types in my combo to have first letter capitalized or all the letters? I tried some properCaps or UCaps functions but they didn't work probably because the bound is on a number (CompanyID).

Thank you!
 
You can do whatever you want with the StrConv() function but you will need to do it in the next form that you open. Are you passing the value in the OpenArgs or getting it some other way?
 
An example for code on a textbox for LastName


Private Sub LastName_AfterUpdate()
Screen.ActiveControl = StrConv(Screen.ActiveControl, 3)
End Sub

The numbers... 1 for all upper, 2 for all lower, 3 to capitalize first letter of every word.
 
I do have the main form and at the "Not in the List" Event it triggers to open a new form in Dialog mode. This new form captures (On Load event) into a text field the text value from the Company combobox from the main form, the user just typed.



The not in the list event in main form is set up response=dataerradd.
 
RuralGuy, Curtis, thank you. It worked!

I have one more case with the same company_ID combobox bound to the Company_ID (an autonumber) and showing to the user in combobox the company name(text).

When the user types a new company the not in the list triggers and runs the following line:

DoCmd.RunSQL ("Insert INTO Company([Company]) VALUES (Company_ID.Text)")

I want somehow the text the user typed to be converted automatically in capital letters before it's updated in the table.

The response set to dataerradd should add this new value to the combobox.

Apparently I need something to convert the .text into capital letters before the sql line.

Thank you and sorry to bothe you guys with simple questions....:)
 
This would be all it takes:
DoCmd.RunSQL ("Insert INTO Company([Company]) VALUES (UCase(Company_ID.Text))")
I would suggest you check with the user first to make sure this in not just a typo.
 
Thank you all!

I do have to start learning harder this VBA.
 

Users who are viewing this thread

Back
Top Bottom