Command button in form to run a querry

Montemontgo

Registered User.
Local time
Today, 02:38
Joined
Oct 25, 2004
Messages
26
In a form of my "cities-of-the-world" database I have amongst others the fields: "Latitude" & "Longitude"
Now I'm looking for the command button code that runs a querry to find all neighbouring places i.e. [Latitude] would be 'Between (Latitude + 0.75) and (Latitude - 0.75)' ... longitude likewise.
In other words: When the form displays the record for Berlin, on clicking the command button there should appear a list containing the cities: Bernau, Oranienburg, Potsdam ...
 
query

Create a query that the form uses as it's record source. In the query under criteria set the latitude to the text box on the form.(between forms![myform].[latitude]and forms![myform].[latitude]+.75...do the same for longitude.

On the form in the On Click of the command button have Me.Requery.

Hope this helps
 

Users who are viewing this thread

Back
Top Bottom