I have a table with Customer orders that have already shipped. What I am try to find out is if the order actually shipped from the closest warehouse (by miles) or not using latitude / longitude. I currently have 6 warehouses.
I have the lat / long formula working in Excel (for a couple of years now) and would like to get it working in Access if possible.
My zipcode Ship To table is in the following format:
Ship To Zip: 46514
Ship To Lat: 41.718730
Ship To Long: -85.937024
My zipcode Ship From table is in the following format:
Ship From Zip: 60439
Ship From Lat: 41.70743
Ship From Long: -87.975568
The Excel formula I use below returns 633.572201 miles.
3963*ACOS(COS(RADIANS(90-(Ship To Lat*24)))*COS(RADIANS(90-(Ship from Lat*24)))+SIN(RADIANS(90-(Ship To Lat*24)))*SIN(RADIANS(90-(Ship From Lat*24)))*COS(RADIANS(24*(Ship From Long-Ship To Long)))))
Any suggestions to incorporate this into Access would be appreciated.
Thanks,
Kurt
I have the lat / long formula working in Excel (for a couple of years now) and would like to get it working in Access if possible.
My zipcode Ship To table is in the following format:
Ship To Zip: 46514
Ship To Lat: 41.718730
Ship To Long: -85.937024
My zipcode Ship From table is in the following format:
Ship From Zip: 60439
Ship From Lat: 41.70743
Ship From Long: -87.975568
The Excel formula I use below returns 633.572201 miles.
3963*ACOS(COS(RADIANS(90-(Ship To Lat*24)))*COS(RADIANS(90-(Ship from Lat*24)))+SIN(RADIANS(90-(Ship To Lat*24)))*SIN(RADIANS(90-(Ship From Lat*24)))*COS(RADIANS(24*(Ship From Long-Ship To Long)))))
Any suggestions to incorporate this into Access would be appreciated.
Thanks,
Kurt