So, we have an old VB 6 App written many many years ago.
It uses an Access Database to store data, and the VB6 App as the interface to this data
Now, to change the VB6 app would be quite difficult, and I'm trying to avoid this.
The problem is, when the VB6 inserts data into a table in the access database, the table has a column which uses 'Now()' to set the default value.
Now there are calculations done on this date and time value, including multiplication. So.. when any of the date/time components are 0, the final result is 0.
I.E dd * mm * yy * hh * n * s - If any are zero, the result is zero
To overcome this I can
• Change the code to specify the date (not very ideal)
• hopefully in the default value of the Access Database put some validation to make sure there are no 0 values in the time
Is there any way to validate the default value like this?
Something like
If DatePart(‘hh’,date) == 0 OR DatePart(‘n’,date) = 0 OR DatePart(‘s’,Date) = 0
Then add one to all of them.
Edit
This is not my code, this is code written way before I, and ther other developers started.
We can't be certain the code we have is the code being used in production. Hence why I'd rather not change code. We are planning on re-writing this soon, when time permits.
The problem only occurs once or twice a month, so it's not vital to the running of the application.