Distance Finder

The ability to calculate the distance between two zip codes is a huge benefit in many software applications. There are many companies online that can provide automated access to the distance of verification software, but not only that cost, but rely on Internet access too. Here we will show the code used to provide this service.
This method can only calculate the distance in miles (divide the result by 1.609344 for me) that the files online, but it is very useful when, for example, are being marketed to everyone on a fixed radius.
So how do we do? The method uses the formula Haversine which implies that the Earth is a sphere. We know that the Earth is not a perfect sphere, but when you are checking between two co-coordinates the map is more than enough accuracy for these purposes.
OK, so without going into technical details of how the formula works, let's go straight to coding requirements for the VBA.
You will have a table in the application that contains all UK postcodes and their X and Y axis coordinates. We are happy to provide this.
The following VBA code attached to the event, click on Calculate distance using a simple form where the user enters the start and end codes zip and distance is calculated.
txtPostCodeStart and txtPostCodeEnd are blank text boxes for entering your search criteria. txtStartLat, txtEndLat, txtStartLong and txtEndLong are text boxes that are filled automatically through event after updating the text boxes using txtPostCodeStart and programming txtPostCodeEnd VBA simple records.
Private Sub caldistance_Click () On Error GoTo Err_caldistance_Click
If Me.TxtPostCodeStart = "" Then MsgBox ( "Enter Zip onset ") Exit Sub End If
If Me.TxtPostCodeEnd = "" Then MsgBox ( "Please enter a zip code End") Exit Sub End If
Distance = (sin ((Me.TxtEndLat * 3.14159265358979) / 180)) * (sin ((_ Me.TxtStartLat * 3.14159265358979) / 180)) + (cos ((Me.TxtEndLat * 3.14159265358979) / 180)) * _ ((cos ((Me.TxtStartLat * 3.14159265358979) / 180))) * _ (Cos ((Me.TxtStartLong – Me.TxtEndLong) * (3.14159265358979 / 180)))
Distance = 6371 * (ATN (-distance / SQR (-distance * distance + 1)) + 2 * Atn (1))
Me.TxTDistance = Distance
Exit_caldistance_Click: Exit Sub
Err_caldistance_Click: MsgBox Err.Description Resume End Sub Exit_caldistance_Click
Although we have demonstrated a simple, the basic formula is there to be used in a variety of ways. We hope you find this as useful as we have, and if you need any assistance, please do not hesitate to contact us or visit our website!
About the Author:
Michael Jillions is a Director for Mill House Data Solutions Ltd. MHDS are specialists in the design of prefessional grade, custom software solutions. http://www.millhousedata.com
Article Source: ArticlesBase.com – Building a facility to check the distance between two uk postcodes in MS Access
Golf Logix GPS Distance FInder
|
|
4x Golf Scope Sport Telescope Golfing Range Finder 10mm
$4.99 New 4x Golf Scope. This is a new 4X golf scope. It measures the distance a standard golf flap post is away from you to determine which club to use. A wristband cord is attached so you can wear it comfortably around the wrist. The golf scope is adjustable for clear viewing. It measures approximately 3 7/16" x 1 3/4" (86.2 x 44.45mm). We work hard to update our descriptions and pictures of our merch... |
|
|
Perfect Solutions Deluxe Golf Distance Finder
$17.00 The pocket-sized Perfect Solutions Golf Distance Finder helps take the guess-work out of selecting the right irons and clubs. This spyglass-style distance finder is compact, simple, and incredibly easy to use. Just put it to your eye and line up the flag with the base line, and immediately you'll have the distance to the pin in both meters and yards. The stylish, platinum-tone Distance Finder come... |
|
|
LASER TARGETING RANGE FINDER
$34.99 SuppliesNet item (DG10275)... |
|
|
Bosch DLR130K Digital Distance Measurer Kit
$98.89 D16 distance measurer. Tru Laser technology, actually measuring the laser light travel distance up to 100'. Larger LCD graphical display along with single Point and Push On/Measurement. Ergonomic rubberized-grip for comfort and impact resistance.... |
|
|
Bosch DLR165K Laser Distance Measuring Device
$269.95 If you are looking for fast, easy, and accurate measuring, look no further than the Bosch DLR165K Digital Laser Range Finder Kit. With precision laser measuring technology, a large measuring range, indirect length measurement, and more, you can count on this tool to handle just about any task. And with a compact, portable design, this handy range finder fits in your pocket, so you'll always have i... |
|
|
Sonin 10275 Laser Targeting Range Finder II
$25.53 The Sonin Laser Targeting Range Finder II is the next generation of electronic distance measuring tools, not only making measuring faster and simpler, but now offers user-friendly targeting ability. This Laser Range Finder uses a high-visibility laser to zero in on a target area, while an ultrasonic beam takes a measurement. This rangefinder is as easy to use as pointing and pushing a button, meas... |
|
|
Nikon 440 ProStaff Laser Range Finder
$299.98 Nikon is a precision optical company with worldwide manufacturing, research and marketing capabilities. The Nikon name is equated with extraordinary photographic performance, innovation, precision and optical quality.PRODUCT FEATURES:Incredible yard accuracy;Original Digital Processor;8 power Multicoated optics;Ranges distances from 11- 440 yards;Focusing Diopter;Scanning Capability;Water Resistan... |
|
|
GSI Super Quality Eyepiece Extender For the CANON EOS 1Ds Mark III, 1Ds Mark II, 1Ds, 1D Mark III, 1D Mark II N, 1D Mark II, 1D, 5D, EOS 50D, 40D, 30D, 20D, 10D, D60, D30, EOS 400D, 350D, 300D, EOS Digital Rebel XTi, Digital Rebel XT, Digital Rebel Kiss Digital X, Kiss Digital N, Kiss Digital, EOS Rebel T2, Rebel Ti, Rebel K2, Rebel GII, Rebel G, Rebel 2000, EOS 1V, 3, IX Lite - Functions Exactly as the Canon EP-EX15.
$19.99 The GSI Eye Cup Extender mounts between the camera's eyecup and the viewfinder. It provides a 15mm extension that makes the viewfinder easier to use - by keeping your nose off of the LCD, and thus avoiding smears. The eyepiece extender makes using the viewfinder noticeably more comfortable.... |
|
|
Golf Buddy World Platinum GPS Range Finder
$399.95 Golf Buddy GPS Rangefinder...World Platinum Edition! Golf Buddy World Platinum GPS Rangefinder features: High-resolution color, outdoor visible, full-function touch screen Ability to switch back-and-forth from standard numbers readings to layout mode Preloaded with courses from across the world Vibrant yet simple-to-use user interface Four player score tracking module Full statistical analysis mod... |
|
|
GOLF DISTANCE FINDER
$2.95 This Golf Distance Finder enables you to make smarter golf club choices taking your game to a higher level. This golf training aid sharpens your skill in determining the distance to the flag. Just sight the flagstick through the viewfinder of this handy golf training aid and line it up within the distance scale to see just how far you are from the pin. This golf distance finder has a scale that ra... |
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.






