Microsoft
Software
Hardware
Network
Question : can i use right([ClientName] to get the last part of a string in a Microsoft Access query if i don't know how long the last part is?
Hi Experts,
Field ClientName is stored in database as one string, for example "Tracy Morris". There is always a space between first name and last name. I need to bring out just the last name to filter for results on a form. The customer needs to search by last name only, but it isn't store anywhere in the database like that. So in my query, i have Last Name: Right([ClientName]), and i get an error. I can put in LastName: Right([ClientName], 6) and i will just get the last name "Morris", but the problem is, i don't have any way to know how long the last names will be. Can i just pull for the last section of a string, or pick up from the space between the first and last names? Thanks :-)
Laura
Answer : can i use right([ClientName] to get the last part of a string in a Microsoft Access query if i don't know how long the last part is?
use the mid function
Mid([ClientName], Instrrev([ClientName]," ") +1)
or add a trim
Trim(Mid([ClientName], Instrrev([ClientName]," ") +1))
Random Solutions
Access VBA to test for login or logout status ( If then Next)
Change IP Address of Windows 2000 Domain Controller
Automate exporting pivot table from access to excel
Exchange 2007 booking a conference room
IntoPath-How to populate a non-repeating field with a repeating field value on a condition
An updateble datagridview in a a Winforms application
Tivoli Storage Manager Backup Archive Client App Crash DSM.EXE after installing on Windows Server 2008 R2 64 bit
Using Range in DoCmd.TransferSpreadsheet acImport
Print Word 2003 document from Access 2003 form with contents of current record.
Move smtp cdo message to a file