Question : Remove unwanted character from field

I have a query in Access that produces a letter to be sent to a customer. The letter contains the name of their job (tblCostingMain.CMJobTitle) amongst other fields. The query being used is attached below.

The problem I have is that the job title contains some characters that I do not want to appear on the letter being sent to the customers. Our job titles will look something like "JobTitle--PBD". The "--PBD" at the the end of the title is an internal reference so that staff are aware when the job is ready to be produced.

Basically what I need to be able to do is remove the "--PBD" from the end of the jobtitle and just be left with the actual title.

Is this possible?

Thanks

Ben
Code Snippet:
1:
2:
3:
SELECT tblCostingMain.CMID, tblCostingMain.CMJobNo, tblCostingMain.CMJobTitle, tblCostingMain.CMQuantity, tblCostingMain.CMCSR, tblCostingMain.CMStatus, tblCostingMain.CMDateAdded, tblCostingMain.CMOldFlag, tblInserterMain.IID AS tblInserterMain_IID, tblInserterMain.ICMID, tblInserterMain.ITotalQtyInserted, tblInserterMain.ITotalNoOfInserts, tblInserterMain.IFullRun, tblInserterMain.IPartRun, tblInserterMain.IInfoConfirmed, tblInserterMain.IInsertTitle_Qty, tblInserterMain.IInsertsHold, tblInserterMain.IInsertsSitma, tblInserterMain.IInsertsThrow, tblInserterMain.IMagDistribution, tblInserterMain.ITotalStocks, tblInserterMain.ITotalOdds, tblInserterMain.ITotalMagsInserted, tblInserterMain.IMagsInsertedSign, tblInserterMain.IMachineCleared, tblInserterMain.IMachineClearedSign, tblInserterMain.IInfoComplete, tblInserterMain.IInfoCompleteDate, tblInserterMain.IMagOversQty, tblInserterMain.IAdditionalInfo, tblInserterMain.ISigned, tblInserterMain.IMailedQty, tblInserterMain.ISitmaInstructions, tblInserterMain.ICarrierSupplied, tblInserterMain.ICarrierWePrint, tblInserterMain.IInsertsConfirmed, tblInserterMain.IInsertOversInfo, tblInserterMain.IInsertsInfoCompleted, tblInserterMain.IInsertsInfoCompletedDate, tblInserterMain.ILastUpdate, tblInserterSub3.IS3ID, tblInserterSub3.IID AS tblInserterSub3_IID, tblInserterSub3.IS3InsertNo, tblInserterSub3.IS3InsertName, tblInserterSub3.IS3QtySupplied, tblInserterSub3.IS3Size, tblInserterSub3.IS3WhichCopies, tblInserterSub3.IS3ADVCopies, tblInserterSub3.IS3OutworkQty, tblInserterSub3.IS3OutworkNote, tblInserterSub3.IS3BinderyQty, tblInserterSub3.IS3BinderyNote, tblInserterSub3.IS3BenchQty, tblInserterSub3.IS3BenchNote, tblInserterSub3.IS3SitmaQty, tblInserterSub3.IS3SitmaNote, tblInserterSub3.IS3BalanceQty, tblInserterSub3.IS3BalanceNote, tblInserterSub3.IS3COI, tblInserterSub3.IS3Info, tblInserterSub3.IS3OptionsPerInstructions, [IS3SitmaQty]+[IS3BenchQty]+[IS3BinderyQty]+[IS3OutworkQty] AS Total
FROM (tblCostingMain INNER JOIN tblInserterMain ON tblCostingMain.CMID=tblInserterMain.ICMID) INNER JOIN tblInserterSub3 ON tblInserterMain.IID=tblInserterSub3.IID
WHERE (((tblCostingMain.CMJobNo)=[Enter Job Number]) AND (([IS3SitmaQty]+[IS3BenchQty]+[IS3BinderyQty]+[IS3OutworkQty])>0));
Open in New Window Select All

Answer : Remove unwanted character from field

use

left([jobtile],instr([jobtitle],"-")-1)  

to remove the characters after the jobtitle
Random Solutions  
 
programming4us programming4us