Question:
How do I compare dates in VB? Also, how do I store dates into Access? I can’tget them into the right format.
Answer:
For comparison of dates, look up the documentation on the DateDiff function. There are several other similar functions for adding dates and getting pieces of the date. DateDiff is a very powerful and useful function.
As far as storing dates, Access is fairly forgiving about how dates look. If you are doing insert statements into the database, put the date into a Variant type before you do it as Access likes that better. You can use the CVar function to convert just about anything to a variant, but don’t use Variant variables as each one takes 64k of memory. Not good. If you set the format property on the masked edit box, you can get the date in the format you want fairly easily.
To format dates, use the Format function. The Format function allows you to format a date in virtually any format imaginable, including generic International dates.