PDA

Click to See Complete Forum and Search --> : Date formats in Access via VB6


Caro
Oct 1st, 1999, 04:33 PM
I am fairly new to VB and am accessing an Access database which contains dates. Does anyone have a recommended format for a date field (without time). I just need a pointer as to how to define it in Access and then how to validate it in VB6. Is there a standard or best way to do this? Thanks for all your help.

JHausmann
Oct 2nd, 1999, 09:28 AM
Define the date field in whatever format you desire, in Access. It's going to keep the internal representation (a float) no matter what you choose. The Decimal portion of the number (should you decide to test the date value by converting it to a long) represents the number of days since 12/30/1899. The statement Cint(Date), currently, should give a number > 36400.

VB6 has a new function "IsDate" that returns a boolean value. You can use this and some combination of the DateAdd function to test a dates validity.