Compile function Delete_COMPANY_Record_From_SQL(Connection, Key, Record)

/*****************************************************************************\
	Deletes the given COMPANY record from the MSSQL database.
	
	History
	-------
	09/21/2010    KRF   Original Programmer
\*****************************************************************************/

Declare function SQL_Delete, SQL_Format
Ans = ""
				    
// List of key names and their values
Keys = "CO_NO":@VM:SQL_Format(Key, "DEC", "0")

//-------------------------------------------------------------------------------------------------
// Multi-valued Fields

!! Delete records from MV tables first !!

// COMPANY_ADDRESS_LINES
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "COMPANY_ADDRESS_LINES", Keys)
end

// COMPANY_PHONES
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "COMPANY_PHONES", Keys)
end

// COMPANY_INTL_PHONES
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "COMPANY_INTL_PHONES", Keys)
end

// COMPANY_NOTES
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "COMPANY_NOTES", Keys)
end

// COMPANY_SHIPPER_INFO
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "COMPANY_SHIPPER_INFO", Keys)
end

// COMPANY_BILL_TO_ADDRESS_LINES
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "COMPANY_BILL_TO_ADDRESS_LINES", Keys)
end

// COMPANY_SHIP_TO_ADDRESS_LINES
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "COMPANY_SHIP_TO_ADDRESS_LINES", Keys)
end

// COMPANY_VREMIT_ADDR_LINES
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "COMPANY_VREMIT_ADDR_LINES", Keys)
end

// COMPANY_CREDIT_INFO
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "COMPANY_CREDIT_INFO", Keys)
end

// COMPANY_SHIP_TO_CUST_NOS
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "COMPANY_SHIP_TO_CUST_NOS", Keys)
end

// COMPANY
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "COMPANY", Keys)
end

Return Ans
