AUTOMATING EXPIRY DATE FROM THE DATE ENTERED

H

Howard Brody

Build a form with three TextBoxes: [txtName], [txtArrive],
[txtExpire]. In the LostFocus event for [txtArrive] use
the following code:

Private Sub txtArrive_LostFocus()

Dim dtArr as Date
Dim dtExp as Date

dtArr = [txtArrive]

dtExp = DateSerial(Year(dtArr) + 2, Month(dtArr), Day
(dtArr))

[txtExpire] = dtExp

End Sub

Check the Help file for DateSerial. It's a useful function
and I use it often.

Hope this helps!

Howard Brody
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top