Convert Space to an Underscore

ddrew

seasoned user
Local time
Today, 19:35
Joined
Jan 26, 2003
Messages
911
Is it possible to convert a space to an underscore in a combobox. I need a naming convention within a combobox, at present some people use spaces and some people use underscore, I want underscore as the norm. The only reason for this is that in another program that is used we have to use underscore so it makes sense that they are the same!
 
Simple Software Solutions

On the AfterUpdate or OnChange or LostFocus of a control

Use the following command

Me.ActiveControl = Replace(Me.ActiveControl," ","_")

This will replace all instances of a Space to and underscore.

CodeMaster::cool:http://www.icraftlimited.co.uk
 
You can use the Replace() function to do this in the SQL used by your RowSource for your combobox.

I tested this on a combobox. My original statement was this

SELECT UtilityTable.NName FROM UtilityTable ORDER BY [NName];

I modified the statement to this

SELECT Replace(UtilityTable.NName," ","_") FROM UtilityTable ORDER BY [NName];

and got the results you want, while retaining full functionality of the combobox.
 

Users who are viewing this thread

Back
Top Bottom