
To comply with this constraint, any strings that are too long to fit in a single line are unceremoniously chopped into pieces, without regard for natural word breaks or the English rules of hyphenation.įor example, in the second example, "Receipts.Principal" is split into "Rec" and "eipts.Principal". The SaveAsText formats all enforce a strict maximum line length in their exported files. In other words, changing a single character in the SQL string would appear to version control to be an entirely different query. Thus, the exported query would switch to using the "dbMemo" approach. Access would no longer be able to represent the join in the drag-and-drop interface. The second example does not support drag-and-drop, so the entire SQL is exported as a "dbMemo" field.Ĭonsider what would happen if we changed the equal sign ( =) in the join clause of the first query to a greater-than sign ( >). Instead it lists the tables, joins, columns, sorts (ORDER BY), and filters (WHERE clauses) that comprise the query. The first example above does not export any SQL. Inconsistent File FormatĪccess has a drag-and-drop interface for building queries, but not all joins support this feature. It conveys no information about the functionality of the query. Many of the lines in the files are dedicated to where the query object should appear within the Access window. I want to point out a few things about the above files. "Forms]!!))) \015\012"ĭbText "Description" ="Used exclusively to populate the Pre-Posting Report" ") AND ((CMRLoan.LoanType)=!!) AND ((CMRLoan.Inv_" "an.LoanType = LoanType.ID) INNER JOIN Particip ON CMRLoan.Inv_Code = Particip.In" "R JOIN CMRLoan ON Receipts.LoanID = CMRLoan.LoanID) INNER JOIN LoanType ON CMRLo" "ipts.Apply_Date, Receipts.ReceiptID, CMRLoan.Balance\015\012FROM ((Receipts INNE" "esc, Is Not Null AS Posted, Receipts.IsPayoff, CMRLoan.LoanID, Rece" "]- AS RemBalance, Particip.Name AS PartName, LoanType.Desc AS LnTypeD" "eipts.Principal, Receipts.Interest, Receipts.Service, CMRLoan.Category, [Balance"

PostingsReport.qry: dbMemo "SQL" ="SELECT Receipts.NP_Date, Receipts.Accr_Date, CMRLoan.Account, Receipts.Type, Rec" Here are two sample outputs from the SaveAsText procedure:Įxpression ="Not IsNull(HistorySubquery.LoanID)"Įxpression ="CMRLoan.LoanID=HistorySubQuery.LoanID" I'm not going to suggest we should replace this portion of the decompose.vbs script.

The main purpose of the exported text file is to be able to re-create the QueryDef object upon running the LoadFromText procedure. While this creates a text file, calling it "human-readable" is probably a stretch. The original decompose.vbs script exports the QueryDef objects using the undocumented SaveAsText procedure. I've written several posts expanding on this StackOverflow answer to the question, " How do you use version control with Access development?" Today I want to talk about exporting queries.
