G
Guest
I have this code that was provided in a module.
Public Function FirstCharUC(sText As String) As String
Dim sTmp() As String
Dim iCtr As Integer
If Len(Trim(sText)) > 0 Then
sTmp = Split(sText)
For iCtr = 0 To UBound(sTmp)
sTmp(iCtr) = UCase(Left(sTmp(iCtr), 1)) & Mid(sTmp(iCtr), 2)
Next iCtr
FirstCharUC = Join(sTmp)
Else
FirstCharUC = sText
End If
End Function
I have this code in the AfterUpdate control in the form on the field.
Me!PrspDemoAddrLine1 = FirstCharUC(Me!PrspDemoAddrLine1)
The codes works great. Exactly what I needed. Here's the problem though. If I delete all the information after the record has been saved I get a VB error code of Run Time Error 94. Invalid use of null.
Is there something that I can add to the AfterUpdate control just before the code to prevent it doing this? Everything else is great though.
Public Function FirstCharUC(sText As String) As String
Dim sTmp() As String
Dim iCtr As Integer
If Len(Trim(sText)) > 0 Then
sTmp = Split(sText)
For iCtr = 0 To UBound(sTmp)
sTmp(iCtr) = UCase(Left(sTmp(iCtr), 1)) & Mid(sTmp(iCtr), 2)
Next iCtr
FirstCharUC = Join(sTmp)
Else
FirstCharUC = sText
End If
End Function
I have this code in the AfterUpdate control in the form on the field.
Me!PrspDemoAddrLine1 = FirstCharUC(Me!PrspDemoAddrLine1)
The codes works great. Exactly what I needed. Here's the problem though. If I delete all the information after the record has been saved I get a VB error code of Run Time Error 94. Invalid use of null.
Is there something that I can add to the AfterUpdate control just before the code to prevent it doing this? Everything else is great though.