Only want the first 3 letters to show

B

Bob

Is there some way I can alter this code or use properties so as only the
first 3 letters of the last name will show from the last name!
=IIf(DLookUp("OwnerLastName","tblOwnerInfo","OwnerID=" & [tbOwnerID])="" Or
IsNull(DLookUp("OwnerLastName","tblOwnerInfo","OwnerID=" &
[tbOwnerID])),"",DLookUp("OwnerLastName","tblOwnerInfo","OwnerID=" &
[tbOwnerID]))

Thanks in advance.........Bob Vance
 
T

Tom Wickerath

Hi Bob,

The Left function can be used for this purpose:

Left([Expression], n)

where n = the number of characters (3 in your case).

Your expression looks truly horrid. What are you trying to accomplish? There
may be an easier way to get to the same result, rather than using a
conditional IF with a domain aggregrate function.


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
 
S

schasteen

Why don't you simplify your experssion:

Left(DLookUp("OwnerLastName","tblOwnerInfo","OwnerID=" & [tbOwnerID]),3)

If the Dlookup is null or "" then you don't return any value, but if you
must have the zero length string you can also use the Nz() function.

Another trick to test for null and "" is
len(DLookUp("OwnerLastName","tblOwnerInfo","OwnerID=" & [tbOwnerID]) = 0.
This will detect both a zero length string and null instead of testing for
both.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top