SQL question
Posted: Mon Mar 06, 2006 5:25 pm
Hello all. I am having a problem with the following statement. Basically, if a checkbox is true, then I want it to run the first command, but if it is not, I want it to run the second one. The second part works fine by itself, but once I added the IF/ELSE section, I am getting errors. I am sure it is in the UPDATE statement, but I am not sure what I am doing wrong. Any suggestions?
Here is the code:
Thanks in advance,
Parallon
Here is the code:
Code: Select all
If toActuals = "-1" then
sSQL = "INSERT INTO WOLabour (Employee,TransDate,WoNum,LaborType,Scale,Hours,Rate,Tax1,Tax2,AddCost,TotalCost,Account,Description,ModifyDate,Estimate,Actual,Craft,ChargeBack,TaskNum,ChargeBackAmount) SELECT Employee," _
& nextissue3 & ",'" & wo & "',LaborType,Scale,Hours,Rate,Tax1,Tax2,AddCost,TotalCost,Account,Description,'" & curDate & "',1,Craft,ChargeBack,TaskNum,ChargeBackAmount FROM PMLabor WHERE PmNum = '" & pm & "'"
sSQL = "UPDATE WOlabour SET Actual = '-1' WHERE PmNum = '" & pm & "'"
else
sSQL = "INSERT INTO WOLabour (Employee,TransDate,WoNum,LaborType,Scale,Hours,Rate,Tax1,Tax2,AddCost,TotalCost,Account,Description,ModifyDate,Estimate,Craft,ChargeBack,TaskNum,ChargeBackAmount) SELECT Employee," _
& nextissue3 & ",'" & wo & "',LaborType,Scale,Hours,Rate,Tax1,Tax2,AddCost,TotalCost,Account,Description,'" & curDate & "',1,Craft,ChargeBack,TaskNum,ChargeBackAmount FROM PMLabor WHERE PmNum = '" & pm & "'"
conn.Execute sSQL, , 128
end ifParallon