I am designing an export query specifically for importing into quickbooks as invoices. I have to add 4 fields together because you can only import excel into quickbooks with the exact same layout quickbooks uses and in order to add multi-line items into quickbooks, the data has to be setup in a very specific way. The customers sale date, name, and item purchased are all in one description because even though the sale dates are different, they are with the same account so I have to make sure that there is information to let quickbooks know it is a multiline item.
Code:
SELECT DateSerial(Year(Date()),Month(Date())+1,0) AS [INVOICE DATE], [LOGDATE] & " " & [FIRSTNAME] & " " & [LASTNAME] & " " & [ITM.NAME] AS Description, SALEITMS.QTY, [Invoice Class].Class, SALE.TOTALFROM [Invoice Class] INNER JOIN ((SALEITMS INNER JOIN ITM ON SALEITMS.ITEM = ITM.OBJID) INNER JOIN ((SALECHGS INNER JOIN ACCT ON SALECHGS.ACCTNUM = ACCT.OBJID) INNER JOIN ((CUST INNER JOIN CUSTCDE ON CUST.OBJID = CUSTCDE.CUST) INNER JOIN SALE ON CUSTCDE.OBJID = SALE.CUSTCDE) ON (SALECHGS.STE = SALE.STE) AND (SALECHGS.SALEID = SALE.OBJID)) ON (SALEITMS.SALEID = SALE.OBJID) AND (SALEITMS.SITE = SALE.SITE)) ON ([Invoice Class].Site = SALECHGS.SITE) AND ([Invoice Class].Site = SALE.SITE)
GROUP BY ACCT.NAME, SALE.CREATED, DateSerial(Year(Date()),Month(Date())+1,0), [LOGDATE] & " " & [FIRSTNAME] & " " & [LASTNAME] & " " & [ITM.NAME], SALEITMS.QTY, [Invoice Class].Class, SALE.TTL, ITM.NAME
HAVING (((ACCT.NAME)=[Forms]![SearchF]![actname]) AND ((SALE.CREATED) Between [Forms]![SearchF]![fromdate] And [Forms]![SearchF]![todate]));
I have hopefully masked well enough the information that I feel is sensitive, but it is the best that I will be able to do in terms of providing the SQL.