You need to set your project properties, assuming you use VC++.
Press ALT+7, Click on Configuration Properties, go to C/C++ -> Code Generation.
There is an option called Runtime Library, you should set it to Multi threaded. Be aware that you executable size increases with like 300kb.
I tried changing this, but came out with 13 errors and 2 warnings, making the compilation fail. I did not get any before. I changed the setting you said to 'Multi-threaded (/MT)', although there were several others, im not sure If they are similar or not - 'Multi-threaded Debug (/MTd)', 'Multi-threaded DLL (/MD)''Multi-threaded Debug DLL (/MDd)'.
It only seems to complile without errors on the setting 'Multi-threaded DLL (/MD)'.
Dim Adapter As New OleDbDataAdapter
Dim Command As New OleDbCommand
Dim xFrom As String = dtpFrom.Value.ToString.Substring(0, dtpFrom.Value.ToString.IndexOf(" "))
Dim xTo As String = dtpTo.Value.ToString.Substring(0, dtpTo.Value.ToString.IndexOf(" "))
sqlQuery = MainQuery ...