我正在努力使以下查询更好:
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)
我想为账单地址设置一个字段,为发货地址设置一个字段,而不是组成地址的所有单个字段。我想要以下格式:
Company Name
110 Company Street Address
Address second line
City, State Zip
对于某些地址,没有第二个地址行。所以,我想完全跳过那一行。此外,由于某种原因,每个不需要存在的字段后面都有额外的空间。
有谁知道我怎么能做到这一点?