ChrisCione
Board Regular
- Joined
- Aug 27, 2008
- Messages
- 92
- Office Version
- 365
- Platform
- Windows
Hello,
A field in my database is for a control number. The control number varies in length, from 16-20 alphanumeric characters. That control number always* ends in 6 numbers, which I extract and copy to the clipboard using VBA.
*On rare occasion, an alpha character (always an alpha character) may be appended to the end of the number. Example:
"Normal" control numbers
19XYT8C8GGKPPC357395
17JDX8C09YT357395
Modified control numbers
19XYT8C8GGKPPC357395D
17JDX8C09YT357395A
Is it possible to copy the last 7 characters ONLY when an alpha character is appended?
Here's the code currently used:
Many thanks in advance.
A field in my database is for a control number. The control number varies in length, from 16-20 alphanumeric characters. That control number always* ends in 6 numbers, which I extract and copy to the clipboard using VBA.
*On rare occasion, an alpha character (always an alpha character) may be appended to the end of the number. Example:
"Normal" control numbers
19XYT8C8GGKPPC357395
17JDX8C09YT357395
Modified control numbers
19XYT8C8GGKPPC357395D
17JDX8C09YT357395A
Is it possible to copy the last 7 characters ONLY when an alpha character is appended?
Here's the code currently used:
Code:
Dim str As String, strRight As String
On Error GoTo HandleError
str = [txtRPANumber]
strRight = Right(str, 6)
Dim clipboard As Object
Set clipboard = CreateObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
clipboard.SetText strRight
clipboard.PutInClipboard
HandleExit:
Exit Sub
HandleError:
MsgBox "There is no RPA in this record."
Resume HandleExit
Many thanks in advance.