次のクエリを改善するために取り組んでいます。
Set rs = CurrentDb.OpenRecordset("SELECT CONSG.custpartno AS Assembly, SOM.sono AS SO, SOD.line_no AS Rel, PLD.shippedqty AS Qty, INV.descript AS Description, " & _
"SHIPADDR.shipto AS ShipToCompany, SHIPADDR.address1 AS ShipToAddress, SHIPADDR.address2 AS ShipToAddress2, SHIPADDR.city AS ShipToCity, SHIPADDR.state AS ShipToState, SHIPADDR.zip AS ShipToZip, " & _
"BILLADDR.shipto AS BillToCompany, BILLADDR.address1 AS BillToAddress, BILLADDR.address2 AS BillToAddress2, BILLADDR.city AS BillToCity, BILLADDR.state AS BillToState, BILLADDR.zip AS BillToZip " & _
"FROM inventor AS CONSG INNER JOIN ((((((plmain AS PLM INNER JOIN pldetail AS PLD ON PLM.packlistno = PLD.packlistno) INNER JOIN sodetail AS SOD ON PLD.uniqueln = SOD.uniqueln) INNER JOIN inventor AS INV ON SOD.uniq_key = INV.uniq_key) INNER JOIN somain AS SOM ON PLM.sono = SOM.sono) INNER JOIN shipbill AS SHIPADDR ON PLM.linkadd = SHIPADDR.linkadd) INNER JOIN shipbill AS BILLADDR ON PLM.blinkadd = BILLADDR.linkadd) ON CONSG.int_uniq = INV.uniq_key " & _
"WHERE Val(PLM.packlistno) = " & cboPL.value, dbOpenDynaset)
住所を構成する個々のフィールドすべてではなく、請求先住所用に 1 つのフィールドと出荷先住所用に 1 つのフィールドを用意したいと考えています。次の形式でお願いします。
Company Name
110 Company Street Address
Address second line
City, State Zip
一部の住所では、2 行目の住所がありません。ですから、その行は完全にスキップしたいと思います。また、何らかの理由で、各フィールドの後に必要のない余分なスペースがあります。
これを達成する方法を知っている人はいますか?