Terry Lawson
Registered User.
- Local time
- Today, 17:27
- Joined
- Mar 1, 2010
- Messages
- 12
All
I'm having a problem with the following very simple code the lines in red flatly refuse to trap a space followed by a lowercase letter.
I'm trying to write the first set of words that start uppercase to a different field (the first letter in the read field is always uppercase)
Option Compare Database
Option Explicit
Dim i As Integer
Dim rsData As Object
Dim strEntry As String
Dim strForenames As String
Dim strFullName As String
Dim strLastChar As String
Dim strPart As String
Dim strSurnamne As String
Private Sub Form_Open(Cancel As Integer)
Set rsData = CurrentDb.OpenRecordset("Rodmell Manorial")
With rsData
.MoveFirst
Do Until .EOF
strFullName = ""
strEntry = !entry
strLastChar = Left(strEntry, 1)
If Not IsNull(strEntry) Then
For i = 1 To Len(strEntry)
strPart = Mid(strEntry, i, 1)
If strPart = LCase(strPart) Then
If strLastChar = " " Then 'have lowercase letter following
GoTo dunnit
End If
End If
strFullName = strFullName & strPart
strLastChar = strPart
Next i
End If
dunnit:
.Edit
![Full Name] = strFullName
.Update
.MoveNext
Loop
End With
End Sub
Please could somebody tell me what I'm doing wrong.
Many thanks
Terry Lawson
I'm having a problem with the following very simple code the lines in red flatly refuse to trap a space followed by a lowercase letter.
I'm trying to write the first set of words that start uppercase to a different field (the first letter in the read field is always uppercase)
Option Compare Database
Option Explicit
Dim i As Integer
Dim rsData As Object
Dim strEntry As String
Dim strForenames As String
Dim strFullName As String
Dim strLastChar As String
Dim strPart As String
Dim strSurnamne As String
Private Sub Form_Open(Cancel As Integer)
Set rsData = CurrentDb.OpenRecordset("Rodmell Manorial")
With rsData
.MoveFirst
Do Until .EOF
strFullName = ""
strEntry = !entry
strLastChar = Left(strEntry, 1)
If Not IsNull(strEntry) Then
For i = 1 To Len(strEntry)
strPart = Mid(strEntry, i, 1)
If strPart = LCase(strPart) Then
If strLastChar = " " Then 'have lowercase letter following
GoTo dunnit
End If
End If
strFullName = strFullName & strPart
strLastChar = strPart
Next i
End If
dunnit:
.Edit
![Full Name] = strFullName
.Update
.MoveNext
Loop
End With
End Sub
Please could somebody tell me what I'm doing wrong.
Many thanks
Terry Lawson