Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Array
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Array

 Post Reply Post Reply Page  <123
Author
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 08 November 2004 at 9:16am
That would result in quite a big table though. If Britain for example has 1000 postal codes and you calculate the closest two for each one. Well you do the math.
Back to Top
Mattblack View Drop Down
Groupie
Groupie
Avatar

Joined: 21 January 2003
Location: United Kingdom
Status: Offline
Points: 139
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mattblack Quote  Post ReplyReply Direct Link To This Post Posted: 08 November 2004 at 11:59am

Post code table looks like this...

pc lat lon
AB12 57.101 -2.111
AB13 57.108 -2.237
AB14 57.101 -2.27
AB15 57.138 -2.164
AB16 57.161 -2.156
AB21 57.21 -2.2

3000+ entries in it.  If you search for post codes within 20 miles u will get about 100/200 returns.

SQL isnt an option im affriad, only have access and cant afford to get sql as im only doing my websites for fun - not profit

Thanks so far guys.  What are these modules then?

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 09 November 2004 at 2:38pm
Modules are vba blocks that you can use to program in access or any office product for that effect.

Go ahead and send the table layout of all affected tables and what input fields the users has, maybe I can come up with a good way for you.
Back to Top
Mattblack View Drop Down
Groupie
Groupie
Avatar

Joined: 21 January 2003
Location: United Kingdom
Status: Offline
Points: 139
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mattblack Quote  Post ReplyReply Direct Link To This Post Posted: 09 November 2004 at 2:49pm

not fully designed it yet mate.

The previous example is the post code table.  say the table is called tblPC

There will be maybe a table called tblAdverts and there will be a primary key of something like ad_ID and a field called postcode or PC.

Cheers again

Matt

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 10 November 2004 at 11:29am
Well it actually does not seem as complicated after I took a peek at it.
Assuming you have a table structure like the following

Advertisements
AdID - Autonumber - PK
AdName - Text
PostalCode - Text

PostalCodes
PostalCode - Text(5) - PK
Lat - Number(Double)
Lon - Number(Double)

Then you could simple do a query as the following:


SELECT Advertisements.AdID, Advertisements.AdName, Advertisements.PostalCode
FROM Advertisements INNER JOIN PostalCodes ON Advertisements.PostalCode = PostalCodes.PostalCode
WHERE SQR
(

(
     (69.1 * (PostalCodes.Lat - (Select [PostalCodes].[Lon] From PostalCodes where PostalCodes.PostalCode=[PostCode])))
     *
      (69.1 * (PostalCodes.Lat - (Select [PostalCodes].[Lon] From PostalCodes where PostalCodes.PostalCode=[PostCode])))
)
    +
(
    (69.1 * (PostalCodes.Lon - (Select [PostalCodes].[Lat] From PostalCodes where PostalCodes.PostalCode=[PostCode])) * cos((Select [PostalCodes].[Lon] From PostalCodes where PostalCodes.PostalCode=[PostCode]) / 57.3))
      *     ; 
     (69.1 * (PostalCodes.Lon - (Select [PostalCodes].[Lat] From PostalCodes where PostalCodes.PostalCode=[PostCode])) * cos((Select [PostalCodes].[Lon] From PostalCodes where PostalCodes.PostalCode=[PostCode]) / 57.3))
)

)
< 50;

and it theoretically should show all Ads within 50 miles. Just substitude [PostCode] in asp with something like: ...'" & strUserPostCode & "'...."

I am sure you need at least access 2000 for that but that should be a given.

Edited by michael
Back to Top
 Post Reply Post Reply Page  <123

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.