Compile function Delete_CUST_EPI_PART_Record_From_SQL(Connection, Key, Record)

/*****************************************************************************\
	Deletes the given CUST_EPI_PART record from the MSSQL database.
	
	History
	-------
	04/24/2012    KRF   Original Programmer
\*****************************************************************************/

Declare function SQL_Delete, SQL_Format
Ans = ""
				    
// List of key names and their values
Keys  = "CUST_NO":@VM:SQL_Format(Field(Key, "*", 1), "INT"):@FM
Keys := "EPI_PN" :@VM:SQL_Format(Field(Key, "*", 2), "STR")

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

!! Delete records from MV tables first !!

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

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

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

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

Return Ans
