FoeHunter
Board Regular
- Joined
- Nov 12, 2008
- Messages
- 236
I have a form that allows the user to have the system automatically enter their name into the form using the code below. 9 out of 10 times this works great, except for someone who has a common name, then they have a number added at the end.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>
Here is the code that I have to start with that removes the period between the first and last name.
<o> </o>
<o> </o>
For the sake of being ridiculous and covering every possible combination, let’s say I have an employee with the name Bob.Jenkins1234567890. How can I have VBA replace multiple values in one pass, or how do I set it up to run multiple lines of code? I figured it would be as easy as copy/paste the replace line and replace the dot with a number, but only the last line of code is updated on the screen.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>
Here is the code that I have to start with that removes the period between the first and last name.
<o> </o>
Code:
UserName = Environ("USERNAME")
Me.Text1 = UserName
Me.Text1 = Replace(UserName, ".", " ")
For the sake of being ridiculous and covering every possible combination, let’s say I have an employee with the name Bob.Jenkins1234567890. How can I have VBA replace multiple values in one pass, or how do I set it up to run multiple lines of code? I figured it would be as easy as copy/paste the replace line and replace the dot with a number, but only the last line of code is updated on the screen.