Nov 27, 2005 #1 Shout Programmer Joined Feb 4, 2003 Messages 3 Location NO Hi, how do I get the correct number of months when calculating months between a "yrmo"-field. Eksample: 200510 and 200410. Thanks.
Hi, how do I get the correct number of months when calculating months between a "yrmo"-field. Eksample: 200510 and 200410. Thanks.
Nov 28, 2005 #2 Remou Technical User Joined Sep 30, 2002 Messages 13,030 Location BE Hi I think you need DateDiff. The example above would, perhaps, look like this: Code: strDate1 = "200410" strDate2 = "200510" dte1 = DateSerial(Left(strDate1, 4), Mid(strDate1, 5, 2), 1) dte2 = DateSerial(Left(strDate2, 4), Mid(strDate2, 5, 2), 1) intDiff = DateDiff("m", dte1, dte2) Upvote 0 Downvote
Hi I think you need DateDiff. The example above would, perhaps, look like this: Code: strDate1 = "200410" strDate2 = "200510" dte1 = DateSerial(Left(strDate1, 4), Mid(strDate1, 5, 2), 1) dte2 = DateSerial(Left(strDate2, 4), Mid(strDate2, 5, 2), 1) intDiff = DateDiff("m", dte1, dte2)