Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variables for a query

Status
Not open for further replies.

stiv76

Technical User
Apr 24, 2005
3
US
This is a query to find the search radius of a zip code within a certain parameter. The input to be entered from a form with a dropdown menu and text box. I would like to do is replace the "50" with a variable from the
pulldown menu (2, 5, 10, 20, or 50) and the zipcode "27017" with the zip
code itself from the form field.

round(
((1.852 * 60.0 * ((acos(sin(zc2.rlat) * sin(zc1.rlat) + cos(zc2.rlat)
* cos(zc1.rlat) * cos(abs( (zc1.rlong)-(zc2.rlong) )) )/pi())*180)) /
1.609344),2)
as Distance
from ZipCode zc1, ZipCode zc2
where
zc2.zip = '27017'
and
((1.852 * 60.0 * ((acos(sin(zc2.rlat) * sin(zc1.rlat) + cos(zc2.rlat)
* cos(zc1.rlat) * cos(abs( (zc1.rlong)-(zc2.rlong) )) )/pi())*180)) /
1.609344) <= 50
and zc1.zip not like '27017'
order by
((1.852 * 60.0 * ((acos(sin(zc2.rlat) * sin(zc1.rlat) + cos(zc2.rlat)
* cos(zc1.rlat) * cos(abs( (zc1.rlong)-(zc2.rlong) )) )/pi())*180)) /
1.609344)

Thank you,

Greg
 
You can use use the following syntax for form's parameter in a query:
[Forms]![mainform name]![control name]

The form must be be an open mainform.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top