From: Del on 1 Mar 2010 12:50 I have a database that is used to track defective parts being returned from our customers. These parts have a warranty of 15 months from the manufacture date. The Manufacture Date Code is formatted as yyyy-mm (Example: 2009-06 would be a Manufacture Date Code of June 2009). I am trying to figure out how to take the Manufacter Date Code and add 15 months to it so I can determine; 1) If the part being returned is still under warranty 2) How many months are left on the warranty. I would then take these to bits of information and dispaly them in a popup any time the database user entered a manufacture date code. Thanks in advance...
From: paii, Ron on 1 Mar 2010 13:55 "Del" <dtlabo(a)gmail.com> wrote in message news:9299e90b-de1c-4e31-a10c-18c0e535f752(a)t41g2000yqt.googlegroups.com... > I have a database that is used to track defective parts being returned > from our customers. These parts have a warranty of 15 months from the > manufacture date. The Manufacture Date Code is formatted as yyyy-mm > (Example: 2009-06 would be a Manufacture Date Code of June 2009). > > I am trying to figure out how to take the Manufacter Date Code and add > 15 months to it so I can determine; > > 1) If the part being returned is still under warranty > 2) How many months are left on the warranty. > > I would then take these to bits of information and dispaly them in a > popup any time the database user entered a manufacture date code. > > Thanks in advance... ' Ending month of warranty, assuming 1st of month DateAdd("m",15,DateSerial(Left("2009-06",4),Right("2009-06",2),1)) ' Months to end of warranty DateDiff("m",now,DateAdd("m",15,DateSerial(Left("2009-06",4),Right("2009-06" ,2),1)))
From: Rich P on 1 Mar 2010 16:28 As you click through your records -- if you have a custom goto next record button you can add this code to it to check warranty dates -- also assuming you have a purchaseDate field. Here is a (bare bones) code sample: Private Sub Form_Load() If DateDiff("m", PurchDate, Now) > 15 Then lblWarranty.Visible = True End If End Sub Private Sub Command5_Click() On Error GoTo Errlbl DoCmd.GoToRecord , , acNext lblWarranty.Visible = False If DateDiff("m", PurchDate, Now) > 15 Then lblWarranty.Visible = True End If Errlbl: End Sub Rich *** Sent via Developersdex http://www.developersdex.com ***
From: Del on 1 Mar 2010 19:10 On Mar 1, 4:28 pm, Rich P <rpng...(a)aol.com> wrote: > As you click through your records -- if you have a custom goto next > record button you can add this code to it to check warranty dates -- > also assuming you have a purchaseDate field. Here is a (bare bones) code > sample: > > Private Sub Form_Load() > If DateDiff("m", PurchDate, Now) > 15 Then > lblWarranty.Visible = True > End If > End Sub > > Private Sub Command5_Click() > On Error GoTo Errlbl > DoCmd.GoToRecord , , acNext > lblWarranty.Visible = False > If DateDiff("m", PurchDate, Now) > 15 Then > lblWarranty.Visible = True > End If > Errlbl: > End Sub > > Rich > > *** Sent via Developersdexhttp://www.developersdex.com*** Thanks Ron and Rich This is very helpful!
|
Pages: 1 Prev: Fill dropdown with values of a field Next: Access system administrator training |