VBA – Access – convert “HH:MM:SS” to double and back

MS Access is something very … interesting. For the last week I was building something on it, which includes dealing with data in HH:MM:SS format. Access has a pretty good feature for dealing with this, but this feature somehow crashes after the 24th hour… There are plenty of ways to go around this restriction and probably everyone has its own favourite method. So here is mine – I have created two functions strDblToString and dblStringToDbl , which work quite OK. They read a string in the format HH:MM:SS and calculate its seconds. Then, once you have the seconds as double you may do any mathematical operation you want. With strDblToString you calculate back the double to a string, which can be displayed in Access. Quite slow, but if you do not mind 0.02 seconds delay it is your thing! 🙂


Here comes the code:

Enjoy it!


VBA Developer

Tagged with: , , ,