D
DS
I have a function that I am trying to write.
If CNT =1 then check ReportCatName, if it has an "s" at the end. If so then
remove it, else do nothing.
If CNT >1 then check ReportCatName, it it has an "s" at the end, do nothing.
If it doesn't have an "s" then add an "s".
This isn't doing it for me. I think the problem is where the "s" is to be
removed.
ReportCatName is a field in a table and has words like Appetizers, Entrees,
etc.
Thanks
DS
Public Function MANY(ReportCatName) As String
Dim CNT As Integer
If CNT = 1 Then
If right(ReportCatName, 1) = "s" Then
ReportCatName = right(ReportCatName, -1)
ElseIf right(ReportCatName, 1) <> "s" Then
ReportCatName
End If
ElseIf CNT > 1 Then
If right(ReportCatName, 1) = "s" Then
ReportCatName
ElseIf right(ReportCatName, 1) <> "s" Then
ReportCatName = ReportCatName & "s
End If
End If
End Function
If CNT =1 then check ReportCatName, if it has an "s" at the end. If so then
remove it, else do nothing.
If CNT >1 then check ReportCatName, it it has an "s" at the end, do nothing.
If it doesn't have an "s" then add an "s".
This isn't doing it for me. I think the problem is where the "s" is to be
removed.
ReportCatName is a field in a table and has words like Appetizers, Entrees,
etc.
Thanks
DS
Public Function MANY(ReportCatName) As String
Dim CNT As Integer
If CNT = 1 Then
If right(ReportCatName, 1) = "s" Then
ReportCatName = right(ReportCatName, -1)
ElseIf right(ReportCatName, 1) <> "s" Then
ReportCatName
End If
ElseIf CNT > 1 Then
If right(ReportCatName, 1) = "s" Then
ReportCatName
ElseIf right(ReportCatName, 1) <> "s" Then
ReportCatName = ReportCatName & "s
End If
End If
End Function