loyal Posted November 2, 2003 Posted November 2, 2003 (edited) I am trying to subtract 2 dates in period Column it works fine with Select Statement but it will be meaning full if it works with Update Statement also I wann subtract TotalDays from Period can someone figure out what is my mistake in this script ? UPDATE Vacation SET DateOfBack = ?, DateOfLeave = ?, LeaveKind = ?, MilitryNumber = ?, Period = ?, TotalDays = ? WHERE (VacationID = ?) AND (DateOfBack = ? OR ? IS NULL AND DateOfBack IS NULL) AND (DateOfLeave = ? OR ? IS NULL AND DateOfLeave IS NULL) AND (LeaveKind = ? OR ? IS NULL AND LeaveKind IS NULL) AND (MilitryNumber = ? OR ? IS NULL AND MilitryNumber IS NULL) AND (Period = DATEDIFF('d', DateOfLeave, DateOfBack) OR ? IS NULL AND Period IS NULL) AND (TotalDays = TotalDays - Period OR ? IS NULL AND TotalDays IS NULL) Edited November 2, 2003 by Robby Quote Gary Says: To be a good programmer, you must be good at debugging
bungpeng Posted November 4, 2003 Posted November 4, 2003 "?" should be your variable right? then can you use "? is NULL..."? Quote
loyal Posted November 4, 2003 Author Posted November 4, 2003 I am sorry I coudn't get it can you please post a code Quote Gary Says: To be a good programmer, you must be good at debugging
Administrators PlausiblyDamp Posted November 4, 2003 Administrators Posted November 4, 2003 What are you using as the database? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
loyal Posted November 6, 2003 Author Posted November 6, 2003 Hi I am using Access Database Quote Gary Says: To be a good programmer, you must be good at debugging
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.