You could also be experiencing problems due to one of the following:
class CFilterApp : public CWinApp
{
private:
CdbDBEngine m_Engine;
CdbDatabase m_Database;
};
//+----------------------------------------------------------------
//
// Function: CMA_LoadCompany
//
// Purpose:
// CMA_LoadCompany loads CtrlInfo, AcctPart, and Entry.nCount
// information from the company located in the file at
// CtrlInfo.sDataPath.
//
// The accounting parts are hard-coded here (according to your
// accounting system).
// These will be used by the wizard to load your accounting
// information, in CMA_LoacAcctPartCode();
//
// Arguments:
// CtrlInfo [in] Used as a reference point to the
// current company and other settings
// AcctPart [out] The structure is filled out by the
// accounting application
// Entry [out] The structure is filled out by the
// accounting application
//
// Returns: TRUE if all the data about the company could be
// successfully loaded, otherwise FALSE
//
// Notes:
//
DllExport BOOL CMA_LoadCompany(
CMA_CTRLINFO& CtrlInfo,
CMA_ACCTPART& AcctPart,
CMA_JOURNALENTRY& Entry)
{
// Set AcctPart and Rollup fields, will be used by
// CMA_LoadAcctPartCodes()
//
AcctPart.nPartCount = 1;
AcctPart.nRollupCount = 0;
AcctPart.nPartNumber = 0;
// One and only one "Prime" account
//
strcpy(AcctPart.aPart[0].szPartName, TEXT("GLAccount"));
strcpy(AcctPart.aPart[0].szPartType, TEXT("Prime"));
AcctPart.aPart[0].nAccountType = ACCOUNTTYPE_NONE;
AcctPart.aPart[0].nFieldSize = 4;
AcctPart.aPart[0].szRollupOn[0] = NULL;
strcpy(AcctPart.aPart[0].szBriefHeading, TEXT("G/L"));
// Seed some value for the progress bar
//
Entry.lCount = 1;
return TRUE;
}
//+----------------------------------------------------------------
//
// Function: CMA_LoadAcctPartCode
//
// Purpose: Load AcctPartCode, assigning AcctCats and Rollups
// where possible
//
//
// Arguments:
// CtrlInfo [in] Used as a reference point to the
// current company and other settings
// AcctPart [in] Used as a reference point to the
// previous account part
// AcctPartCode [out] The structure is filled out by the
// accounting application
//
// Returns: TRUE if another item is found, FALSE otherwise.
//
// Notes:
//
DllExport BOOL CMA_LoadAcctPartCode(
CMA_CTRLINFO& CtrlInfo,
CMA_ACCTPART& AcctPart,
CMA_ACCTPARTCODE& AcctPartCode)
{
// Clear the acctpart codes
//
for (INT i = 0; i < AcctPart.nPartCount; i++)
{
strcpy(AcctPartCode.aPartCode[i].szCode, " ");
}
if ((0 == AcctPart.nPartNumber))
{
// We are a standard account code
//
lstrcpyn(
AcctPartCode.aPartCode[0].szCode,
TEXT("1010"),
MAX_CMA_PARTCODE__Code);
// This is a cash account
lstrcpyn(
AcctPartCode.szDescription,
TEXT("Temp"),
MAX_CMA_PARTCODE__Code);
// It is a cash account
AcctPartCode.nAcctCat = 1010;
// It is a debit account
//
lstrcpyn(
AcctPartCode.szDrCr,
TEXT("D"),
MAX_CMA_ACCTPARTCODE__DrCr);
// TRUE indicates that there is a valid account code being
// returned through the structures that we just assigned.
//
return TRUE;
}
return FALSE;
}
This registry key location may change in future releases of the product and is only guaranteed to work with the Office 2000 release of the SBCM and SBFM.
Also keep in mind that if you are opening the database in CMA_FindFirstCompany, it will not be available in CMA_LoadCompany since the filter DLL is unloaded after CMA_FindClose. The second time the DLL is loaded (to import the data) CMA_FindFirstCompany is not called.
During the CMA_Initialize call, open up a connection to your database and create some temporary files on the local hard drive representing the different companies for which you have data (in other words, CompanyA.dtf, CompanyB.dtf, and so forth). By doing this and making sure that CMA_PACKAGE.szSearchFileName matches the file name extension you use above, you will get a call on each file created above through CMA_FindFirstCompany. For each file, set CMA_CTRLINFO.szCompanyName and CMA_CTRLINFO.szDataPath. Make sure the value of szDataPath allows you to identify this data set if the user selects it. After the user selects a company for importing, CMA_CTRLINFO.szDataPath will contain the value the user selected. An alternate approach is to just look for the filter DLL. If the DLL is installed on the system, you should be able to find it yourself. When looking for companies, CMA_FindFirstCompany will return the first company; calls to CMA_FindNextCompany will return the list of other companies. The only drawback with this approach is that you can have two installations of the DLL on your machine, so make sure that you only return companies for one of your DLLs.
For accounting applications that allow various permission levels and various levels of access to the accounting information, the filter should assume that any user running it has administrative-level permissions and access to all the data contained within the accounting application.