เอาโค้ดนี้ไปวางในแต่ละฟิลล์ในคิวรี่ได้เลย
หมู่
qADDRMU: IIf(IsNull([ADDRMU]),"-",Replace(Replace([ADDRMU],"ม.",""),"หมู่ที่ ",""))
ซอย
qADDRSOI: IIf(IsNull([ADDRSOI]),"-",Replace(Replace([ADDRSOI],"ซอย",""),"ตรอก",""))
ถนน
qADDRRD: IIf(IsNull([ADDRRD]),"-",Replace([ADDRRD],"ถนน",""))
ตำบล
qADDRTB:IIF(isnull(ADDRTB),"-",Replace(Replace(Replace(ADDRTB, "ต.", ""), "ตำบล", ""), "แขวง", ""))
อำเภอ
qADDRAP:IIF(isnull(ADDRAP),"-",Replace(Replace(Replace(ADDRAP, "อ.", ""), "อำเภอ", ""), "เขต", ""))
จังหวัด
qADDRCW:IIF(isnull(ADDRCW),"-",Replace(Replace(ADDRCW, "จ.", ""), "จังหวัด", ""))
และโค้ดรวมทุกโค้ดสำหรับ SQL นะครับ
SELECT IIf(IsNull([ADDRSOI]),"-",Replace(Replace([ADDRSOI],"ซอย",""),"ตรอก","")) AS qADDRSOI, IIf(IsNull([ADDRRD]),"-",Replace([ADDRRD],"ถนน","")) AS qADDRRD, IIf(IsNull([ADDRTB]),"-",Replace(Replace(Replace([ADDRTB],"ต.",""),"ตำบล",""),"แขวง","")) AS qADDRTB, IIf(IsNull([ADDRAP]),"-",Replace(Replace(Replace([ADDRAP],"อ.",""),"อำเภอ",""),"เขต","")) AS qADDRAP, IIf(IsNull([ADDRCW]),"-",Replace(Replace([ADDRCW],"จ.",""),"จังหวัด","")) AS qADDRCW FROM [ชื่อตารางหรือคิวรี่];