- Local time
- Today, 11:18
- Joined
- Feb 28, 2001
- Messages
- 27,162
Actually, for Access, I would expect 12/30/1899 as the "zero" date. Excel uses 12/31/1899 as its zero date. Neither Access nor Excel would store 1/1/1900 as 0 internally. See also later discussion after my code example.
You are right that a JOIN statement would require "ON" clauses but you are incorrect that you can't use field names. I think this would be legal and might even work more or less as you want:
Here's the thing: That NZ on M.MoveDate works OK to set dates to represent zero because a date IS a number internally to Access. At worst, if the JOIN ... ON doesn't work because of bad data, it might still be fixable.
Probably should toss an NZ for T.Position just to avoid nulls on the "T" side of your query. Also, you wrote T.[Position] but in fact you can avoid that. There are no spaces in T.Position so you don't need bracketing. Also, is it correct that you use M.MoveDate but T.[Move Date] ?
You are right that a JOIN statement would require "ON" clauses but you are incorrect that you can't use field names. I think this would be legal and might even work more or less as you want:
Code:
UPDATE
tabMain AS M INNER JOIN tabTemp AS T ON M.Last = T.Last AND M.First = T.First
SET
M.Position = T.[Position],
M.MoveDate = T.[Move Date],
M.RecLastImported = Now()
WHERE
T.Ambig_Name = False AND
( NZ( M.Position,'' ) <> T.[Position] OR
NZ( M.MoveDate, 0) <> NZ( T.[Move Date],0 ) ) ;
Here's the thing: That NZ on M.MoveDate works OK to set dates to represent zero because a date IS a number internally to Access. At worst, if the JOIN ... ON doesn't work because of bad data, it might still be fixable.
Probably should toss an NZ for T.Position just to avoid nulls on the "T" side of your query. Also, you wrote T.[Position] but in fact you can avoid that. There are no spaces in T.Position so you don't need bracketing. Also, is it correct that you use M.MoveDate but T.[Move Date] ?