last letter -s

Tinny

Registered User.
Local time
Yesterday, 17:28
Joined
Oct 29, 2006
Messages
20
how can i remove the letter if is s with vba in my reports?
for example is is bobys to be boby?
 
if right(field,1)="s" then field=left(field,len(field)-1))

what if there is "ss" at the end of a field?
 
gemma-the-husky said:
if right(field,1)="s" then field=left(field,len(field)-1))

what if there is "ss" at the end of a field?

Or there are 2 reports?
 
No is only one report but i dont understand the two ss..why is it posible that eny name ends with ss? i need onlly if is s or whatever last latter

if right(field,1)="s" then field=left(field,len(field)-1))


my problem is that i use ony one textfield like

="I Got Todate" & Date() & "From" & [LastName] & " " & [FirstName] & " the sum of" & [LastPay] & "€ for car payment with car id" & [CarId] & ""
 
Hi =

Have to ask. Is English your native language?

Bob
 
raskew said:
Hi =

Have to ask. Is English your native language?

Bob
I would have said it was highl unlikely with the Euro sign being displayed, wouldn't you.
 
my native language is C#
 
tinny, I think we wondered why you needed to remove the last s from a name. But to do it, wrap my code in a function

function remove_s (intext as string) as string

if right(intext,1)="s" then
remove_s=left(intext,len(intext)-1))
else
remove_s = intext 'don't change it
end if

end function

and call it

="I Got Todate" & Date() & "From" & remove_s(nz([LastName],"")) & " " & remove_s(nz([FirstName],"")) & " the sum of" & [LastPay] & "€ for car payment with car id" & [CarId] & ""

this will take the last s of both the firstname and the lastname

is this what you mean. You need the nz function in case either firstname or lastname are blank (null)
 

Users who are viewing this thread

Back
Top Bottom