Normal Topic Logic problems again (Read 496 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Logic problems again
Oct 7th, 2008 at 1:53pm
Print Post Print Post  
I have the following code running in my Employee database, to calculate the employee's age.  It's supposed to run only in Update mode, and only if the Age element doesn't already contain the employee's current age.  However, I get a "This record has changed" message every time I exit the form.  I'm sure I've messed up the logic because logic always gives me trouble.  Any help would be appreciated.
Code
Select All
// Calculates the employee's age

IF
(
@MODE() = 1
and not (
	@IsBlank(Birthdate) and
	Age = (@YEAR(@DATE)-@YEAR(BirthDate) - ((@MONTH(@DATE) < @MONTH(BirthDate))
	or (@MONTH(@DATE) = @MONTH(BirthDate) AND @DOM(@DATE) < @DOM(BirthDate))))
	)
)

THEN
	Age = @YEAR(@DATE)-@YEAR(BirthDate) - ((@MONTH(@DATE) < @MONTH(BirthDate))
	or (@MONTH(@DATE) = @MONTH(BirthDate) AND @DOM(@DATE) < @DOM(BirthDate))) 

  

**
Captain Infinity
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Logic problems again
Reply #1 - Oct 8th, 2008 at 1:23pm
Print Post Print Post  
Hello Scott,

Have you verified that that section of code is what is causing this problem? If you comment out that section does the error go away?

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged