I found a similar post to my problem below but have been trying everything my limited experience in this can fathom.
The code below is part of an AfterValidate event in a dialog to update a SQL Server table and works great without the section in red. However, I need to update the designated record only if the "FileEventDate" entered in the dialog is more recent than the stored value. I'm getting an error message of "Errors in: event.AfterValidate code: Argument is incorrect data type" despite the fact that they shouldn't be conflicting data types. The other post I found noted some issues with dates in resultsets using SQL Server, but I'm still very much feeling my way through this stuff, so I might be missing something obvious.
Any and all suggestions are welcomed.
The code below is part of an AfterValidate event in a dialog to update a SQL Server table and works great without the section in red. However, I need to update the designated record only if the "FileEventDate" entered in the dialog is more recent than the stored value. I'm getting an error message of "Errors in: event.AfterValidate code: Argument is incorrect data type" despite the fact that they shouldn't be conflicting data types. The other post I found noted some issues with dates in resultsets using SQL Server, but I'm still very much feeling my way through this stuff, so I might be missing something obvious.
Any and all suggestions are welcomed.
Code:
args.add("Ind_ID",currentform.controls.FileIndID.value) args.add("NewLastPhysical",currentform.controls.FileEventDate.value) args.add("NewPhysStatLastUpdated",date()) args.add("NewPhysStatus","") args.add("NewLastDental",currentform.controls.FileEventDate.value) args.add("NewDentStatLastUpdated",date()) args.add("NewDentStatus","") if currentform.controls.FileDocType.value = "Physical Exam" [COLOR="Red"]DIM sqlSelectStatement as c sqlSelectStatement = <<%txt% SELECT individuals_2.LastPhysical FROM [individuals 2] individuals_2 WHERE (Ind_ID = :Ind_ID) %txt% cn.Execute(sqlSelectStatement) dim lastphys as D lastphys=cn.resultset.data(1) if currentform.controls.FileEventDate.value > lastphys[/COLOR] dim sqlUpdateStatement as c sqlUpdateStatement = <<%txt% UPDATE [individuals 2] SET LastPhysical = :NewLastPhysical, PhysStatLastUpdated = :NewPhysStatLastUpdated, PhysStatus = :NewPhysStatus WHERE (Ind_ID = :Ind_ID) %txt% cn.Execute(sqlUpdateStatement,args) end if end if
Comment