2014-02-16 96 views
0

我有一個跟蹤客戶端,客戶端區域和事務類型的MS Access數據庫。 用戶鍵入事務處理,一旦完成,系統需要創建按客戶區域總部排序的字母 客戶區域(區域A,B等)AND事務類型(TransType 1,TransType 2)eg.Region A:TransType 1 ,Region B:TransType 1,Region A:TransType 2.分組數據跟蹤

我正在使用VBA,SQL語句(通過VBA運行),Word OLE自動化,ADODB記錄集和唯一字符串。 任何人都可以建議我如何構建我的數據庫來跟蹤字母和所有關於這些字母的細節?

回答

0

,我發現這個問題的工作流程是:

+Create a list of the transactions sorted by client regions and by transaction types  
+Load into a recordset and go to first record 
+Get the current values for client region and transaction type 
+Create a unique string 
+Create a letter and capture all necessary details in a letter table including the unique string 
+Run a select statement for LetterID for where unique string field is current unique string value 
+Update the transactions with New Letter ID and mark as batched 

+Loop through the whole recordset 
+Move to next record 
+Check if client regions and transaction types is the same. 
+If same, Update the transactions with current Letter ID and mark as batched 
+If different, create using above method.