Compile function Delete_WM_IN_Record_From_SQL(Connection, Key, Record)

/*****************************************************************************\
	Deletes the given WM_IN record from the MSSQL database.
	
	History
	-------
	05/09/2012    KRF   Original Programmer
\*****************************************************************************/

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

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

!! Delete records from MV tables first !!

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

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

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

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

Return Ans
