Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ComboBox Search - UpperCase 1

Status
Not open for further replies.

monkeysee

Programmer
Sep 24, 2002
201
US
I have a combo box on a form with the following code in the After Update event:

' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Name] ='" & Me![Combo77] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

I want the data displayed in the combobox to be Upper Case.

The ">" does not work in the properties format; Nor does the Ucase work in the underlying query.

Is there a line of code that can be added to the after update event procedure that will accomplish this?
Or should there be an event procedure in "lost focus"

Thank you in advance for any help that you can give.
 
By "underlying query" are you referring to the Combo Box Row Source or something else? I would expect uCase() to always work.

Is there a reason you want uppercase? I assume you understand Access is case in-sensitive.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Yes, the combo Row source.
The ucase works on the individual field like 'lastname' and 'firstname'
but when I combine them to display like this: Solórzano, Debra, that field reverts back to however the data was entered.
I also have the ">" in the table format for both fields.

Thanks for any insight!
 
Can you provide the Row Source? I would expect something like this would work:

SQL:
SELECT PersonID, UCase([LastName] & ", " & [FirstName]) FROM tblYourTable

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
This is what I have.. AND today it is working. go figure!

SELECT [ucaselst] & ", " & [ucasefrst] AS Name, Clients.ClientId, Clients.LastName, Clients.FirstName, UCase([Clients.LastName]) AS ucaseLst, UCase([Clients.FirstName]) AS UcaseFrst
FROM Clients
WHERE (((Clients.LastName) Is Not Null))
ORDER BY Clients.LastName;

Thank you so much for your input!
 
I am kind of surprised that "it is working", unless you have two fields in your Clients table named [tt]ucaselst[/tt] and [tt]ucasefrst[/tt] [ponder]


---- Andy

There is a great need for a sarcasm font.
 
Andy,
These are derived columns and I never use them in other expressions as monkeysee has done. Also, I would never alias an expression with the name "name". Name is a property and shouldn't be used anywhere else. I would use:

SQL:
SELECT UCase([LastName]) & ", " & UCase([FirstName]) AS FullName, ClientId, 
LastName, FirstName, UCase([LastName]) AS ucaseLst, UCase([FirstName]) AS UcaseFrst
FROM Clients
WHERE LastName  Is Not Null
ORDER BY LastName, FirstName;

If this is a combo box row source I'm not sure you need all of the columns.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Now, your - Duane - SQL I can understand :)
I would by-pass all [ and ] since there are no spaces or reserved words used in the fields or table's names.


---- Andy

There is a great need for a sarcasm font.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top