Single or stand-alone table (part 6)
Now we are getting to the true meat of the Module! Though SQL separates the Insertion from the Update, I feel it is NOT the Form code's responsibility to make this decision. The Goal is to remove this from the Form and put this decision into the Data Layer. Therefore, these two are combined into a single and simple Save Method. The steps necessary to Insert and Update are the same, combining the is the only way to not have redundant code. in pseudo code the steps are pretty straight forward: If Validate Data = TRUE IF New, then Insert Update Data ID, set to Clean ELSE Update Set to Clean ELSE Sent Error Message(s) Let's take a Look at the Save Method, and then I'll walk you through it. Procedure.i Save(*Class.FighterSize) Protected Sql$, Result, DBID, Length, *MemoryGraphicID Protected PassFail = #False If Validate(*Class) = #False ProcedureReturn #False Else ...