Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Passing parameter to Access

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-16-04, 02:37
MusicalVisions MusicalVisions is offline
Registered User
 
Join Date: Jun 2004
Posts: 3
Question Passing parameter to Access


I have an MSAccess database that I have created the following query:

SELECT Members.*, [theInput] AS InputVal FROM Members

So when I run this in Access an alert pops requesting 'Enter Parameter Value' requesting a value for theInput . So I type a value in that and everything works splendidly.

Can anyone tell me how to include a parameter in my ASP SQL to pass to Access for the value in InputVal so I don't get a 'No value given for one or more required parameters.' error from the JET Database Engine?
Reply With Quote
  #2 (permalink)  
Old 06-16-04, 02:57
rokslide rokslide is offline
Coffee Minion
 
Join Date: Nov 2003
Location: Sydney
Posts: 1,515
Instead of executing the query that way why doing you just do the query directly using ado??
Reply With Quote
  #3 (permalink)  
Old 06-16-04, 03:24
MusicalVisions MusicalVisions is offline
Registered User
 
Join Date: Jun 2004
Posts: 3
[font=Trebuchet MS]
It is a little more complex than my original post and I was just wondering if there is a trick to do what I asked.

So here goes:

User inputs a zip code on an html form and the system needs to output a recordset of all member record zip codes located within the distance specified.

I plan on using this select query from the page that the form posts to:

q = "SELECT * FROM [Members_ZipSearch] WHERE [Miles]<" & MilesInput & " ORDER BY Miles;"

The database query is currently designed as follows:

I am using the join query ( Members_xZip) from my first post ( SELECT Members.*, [theInput] AS InputVal FROM Members ) to create an extra field to join the UserZip to.

This query is included in Members_ZipSearch, as well as ZIPCodes ( table containing longitude and latitude of US zip codes), and ZIPCodes_1 ( 2nd instance of ZIPCodes)

The query that works fine in access when entering a paramter for user's zip code:

SELECT Members_xZip.*, ZIPCodes.ZIPCode, Members_xZip.zip, ZIPCodes.Latitude, ZIPCodes.Longitude, LatLong_byZip.Latitude_x, LatLong_byZip.Longitude_x, 3963*Atn(Sqr(1-(Sin([latitude]/57.2958)*Sin([latitude_x]/57.2958)+Cos([latitude]/57.2958)*Cos([latitude_x]/57.2958)*Cos([longitude_x]/57.2958-[longitude]/57.2958))^2))/(Sin([latitude]/57.2958)*Sin([latitude_x]/57.2958)+Cos([latitude]/57.2958)*Cos([latitude_x]/57.2958)*Cos([longitude_x]/57.2958-[longitude]/57.2958)) AS miles
FROM (Members_xZip INNER JOIN LatLong_byZip ON Members_xZip.theZip = LatLong_byZip.ZIPCode) INNER JOIN ZIPCodes ON Members_xZip.zip = ZIPCodes.ZIPCode;

Admittedly, there may be a better way to design my query to accomplish this. Any input is appreciated.

Bryan
Reply With Quote
  #4 (permalink)  
Old 06-16-04, 03:32
MusicalVisions MusicalVisions is offline
Registered User
 
Join Date: Jun 2004
Posts: 3
Here is the actual query, I had a couple of the field and table names wrong in the previous post.

SELECT Members_xZip.*, ZIPCodes.ZIPCode, Members_xZip.zip, ZIPCodes.Latitude, ZIPCodes.Longitude, LatLong_byZip.Latitude_x, LatLong_byZip.Longitude_x, 3963*Atn(Sqr(1-(Sin([latitude]/57.2958)*Sin([latitude_x]/57.2958)+Cos([latitude]/57.2958)*Cos([latitude_x]/57.2958)*Cos([longitude_x]/57.2958-[longitude]/57.2958))^2))/(Sin([latitude]/57.2958)*Sin([latitude_x]/57.2958)+Cos([latitude]/57.2958)*Cos([latitude_x]/57.2958)*Cos([longitude_x]/57.2958-[longitude]/57.2958)) AS miles
FROM (Members_xZip INNER JOIN ZIPCodes ON Members_xZip.zip = ZIPCodes.ZIPCode) INNER JOIN LatLong_byZip ON Members_xZip.theZip = LatLong_byZip.ZIPCode;

Bryan
Reply With Quote
  #5 (permalink)  
Old 07-02-04, 12:26
sbl70 sbl70 is offline
Registered User
 
Join Date: Jul 2004
Posts: 1
Here it is...

Not sure if you have an answer for your question, but it is rather easy. Just remember to input the paramters in the order they are listed in your query. Also, use quotes for parameters that are strings, dates, etc. You don't have to use quotes for paramters that are numbers.

<%
Dim objRs

Set objRs = objConn.Execute ("exec query_name param1, param2, param3")
%>

You can list as many parameters as you have, just seperate them by commas.

HTH!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On