B
bcap
Hi,
I am trying to create an update statement that works well until I try
to make a IF THEN ELSE decision to determine the status update. Below
is my code. I would sincerely appreciate any thoughts and/or
suggestions ...
DID = Split(Request.Form("DID"),",")
CongratsLetDt = Split(Request.Form("CongratsLetDt"),",")
ShipRefNo = Split(Request.Form("ShipRefNo"),",")
dshipmentdate = Split(Request.Form("dshipmentdate"),",")
StatusA = Split("0",",")
StatusB = Split("1",",")
StatusC = Split("2",",")
Dim id
For id=0 to uBound(DID)
sql_update = "UPDATE DetailRecs"
sql_update = sql_update & " SET "',"
sql_update = sql_update & "CongratsLetDt='" & trim(CongratsLetDt(id))
& "',"
If trim(dshipmentdate(id))="" then
sql_update = sql_update & "dshipmentdate='00000000',"
Else
sql_update = sql_update & "dshipmentdate='" & trim(dshipmentdate(id))
& "',"
End If
If trim(ShipRefNo(id))="" then
Else
sql_update = sql_update & "dshipmentrefno='700900800000645" & trim
(ShipRefNo(id)) & "',"
End if
sql_update = sql_update & "ShipRefNo='" & trim(ShipRefNo(id)) & "',"
' Status Types
' 0 - New
' 1 - Working
' 2 - Pending Finance
' 3 - Approved
' 4 - Fulfilled
If ((trim(CongratsLetDt(id))="" AND (trim(dshipmentdate(id))
="00000000" OR trim(dshipmentdate(id))="") AND trim(ShipRefNo(id))
="")) then
sql_update = sql_update & "Status='" & StatusA(id) & "'"
Else
End If
If (trim(CongratsLetDt(id))="" OR trim(ShipRefNo(id))="" OR (trim
(dshipmentdate(id))="00000000" OR trim(dshipmentdate(id))="")) then
sql_update = sql_update & "Status='" & trim(StatusB(id)) & "'"
Else
End If
If (trim(CongratsLetDt(id))<>"" AND trim(ShipRefNo(id))<>"" AND (trim
(dshipmentdate(id))<>"" OR trim(dshipmentdate(id))<>"00000000")) then
sql_update = sql_update & "Status='" & StatusC(id) & "'"
Else
End If
sql_update = sql_update & "WHERE DID =" & DID(id)
Set rs = conn.Execute(sql_update)
I am trying to create an update statement that works well until I try
to make a IF THEN ELSE decision to determine the status update. Below
is my code. I would sincerely appreciate any thoughts and/or
suggestions ...
DID = Split(Request.Form("DID"),",")
CongratsLetDt = Split(Request.Form("CongratsLetDt"),",")
ShipRefNo = Split(Request.Form("ShipRefNo"),",")
dshipmentdate = Split(Request.Form("dshipmentdate"),",")
StatusA = Split("0",",")
StatusB = Split("1",",")
StatusC = Split("2",",")
Dim id
For id=0 to uBound(DID)
sql_update = "UPDATE DetailRecs"
sql_update = sql_update & " SET "',"
sql_update = sql_update & "CongratsLetDt='" & trim(CongratsLetDt(id))
& "',"
If trim(dshipmentdate(id))="" then
sql_update = sql_update & "dshipmentdate='00000000',"
Else
sql_update = sql_update & "dshipmentdate='" & trim(dshipmentdate(id))
& "',"
End If
If trim(ShipRefNo(id))="" then
Else
sql_update = sql_update & "dshipmentrefno='700900800000645" & trim
(ShipRefNo(id)) & "',"
End if
sql_update = sql_update & "ShipRefNo='" & trim(ShipRefNo(id)) & "',"
' Status Types
' 0 - New
' 1 - Working
' 2 - Pending Finance
' 3 - Approved
' 4 - Fulfilled
If ((trim(CongratsLetDt(id))="" AND (trim(dshipmentdate(id))
="00000000" OR trim(dshipmentdate(id))="") AND trim(ShipRefNo(id))
="")) then
sql_update = sql_update & "Status='" & StatusA(id) & "'"
Else
End If
If (trim(CongratsLetDt(id))="" OR trim(ShipRefNo(id))="" OR (trim
(dshipmentdate(id))="00000000" OR trim(dshipmentdate(id))="")) then
sql_update = sql_update & "Status='" & trim(StatusB(id)) & "'"
Else
End If
If (trim(CongratsLetDt(id))<>"" AND trim(ShipRefNo(id))<>"" AND (trim
(dshipmentdate(id))<>"" OR trim(dshipmentdate(id))<>"00000000")) then
sql_update = sql_update & "Status='" & StatusC(id) & "'"
Else
End If
sql_update = sql_update & "WHERE DID =" & DID(id)
Set rs = conn.Execute(sql_update)