S
Sandy
On a data entry form I have suddenly developed an error on entering the
surname:
“Function: ProperLookup - Error#: 3219: Invalid operationâ€
When I click ‘OK’ I get another error: “Run-time error ‘3315’: Field
‘tblPatients.Surname’ cannot be a zero-length stringâ€
This is the code
Private Sub txtSurname_AfterUpdate()
Dim strUpper As String
Dim varSurname As Variant
Me!txtSurname = ProperLookup(Me!txtSurname)
If Left(Me!txtSurname, 2) = "Mc" Then
varSurname = Me!txtSurname
strUpper = Mid(varSurname, 3, 1)
strUpper = UCase(strUpper)
Mid(varSurname, 3, 1) = strUpper
Me!txtSurname = varSurname
End If
End Sub
and the first line of the function
Function ProperLookup(ByVal varInText As Variant) As Variant.
On debugging, the surname is picked up by the procedure, but is not being
passed on to the function. I have been using this form for some years and
never had any problems.
Any help much appreciated.
surname:
“Function: ProperLookup - Error#: 3219: Invalid operationâ€
When I click ‘OK’ I get another error: “Run-time error ‘3315’: Field
‘tblPatients.Surname’ cannot be a zero-length stringâ€
This is the code
Private Sub txtSurname_AfterUpdate()
Dim strUpper As String
Dim varSurname As Variant
Me!txtSurname = ProperLookup(Me!txtSurname)
If Left(Me!txtSurname, 2) = "Mc" Then
varSurname = Me!txtSurname
strUpper = Mid(varSurname, 3, 1)
strUpper = UCase(strUpper)
Mid(varSurname, 3, 1) = strUpper
Me!txtSurname = varSurname
End If
End Sub
and the first line of the function
Function ProperLookup(ByVal varInText As Variant) As Variant.
On debugging, the surname is picked up by the procedure, but is not being
passed on to the function. I have been using this form for some years and
never had any problems.
Any help much appreciated.