E
Ed_R
I have a query that I'm trying to return the correct value and am
having a problem with it. I believe the problem is the way I'm asking
to return the results of the field. There's a form where you can
enter a departure and arrival point and I want to then go to a table
and find the proper mileage betwen these two points. The field in the
table called location name will return the record where the record
equals the Arival_point_value from the form. Then I only ask to get
the field in that record equal to the departure_point_value. So far
everything works. But then the one line
miles_value = mileObj(" & Departure_point_value & ").Value
is where the problem is. Normally I'd hard code a field name in there
such as shown in the commented out line (Field name is Alexander) but
I don't know what field I want until the person picks that from the
form. So how do I input a variable into: miles_value = mileObj(" &
Departure_point_value & ").Value I tired this but doesn't like the
sytex. What am I doing wrong?? Below is shown the code. Thanks!
Arrival_point_value = Request.Form("Arrival_point")
Departure_point_value = Request.Form("Departure_point")
Set schConn = Server.CreateObject("ADODB.Connection")
schConn.Open Application("cwvo_ConnectionString")
Server.ScriptTimeOut = 600
Set mileObj = schConn.Execute("SELECT " & Departure_point_value & "
FROM Mileage_Chart WHERE Location_name = '" & Arrival_point_value &
"' ")
If mileObj.EOF <> true then
' miles_value = mileObj("Alexander").Value
miles_value = mileObj(" & Departure_point_value & ").Value
Response.write "<font face=""arial,helv"" size=""3"">The mileage from
your departure point: " & Departure_point_value & " to arrival point "
& Arrival_point_value & " is: <B>" & miles_value & " </B>miles <P>"
End IF
having a problem with it. I believe the problem is the way I'm asking
to return the results of the field. There's a form where you can
enter a departure and arrival point and I want to then go to a table
and find the proper mileage betwen these two points. The field in the
table called location name will return the record where the record
equals the Arival_point_value from the form. Then I only ask to get
the field in that record equal to the departure_point_value. So far
everything works. But then the one line
miles_value = mileObj(" & Departure_point_value & ").Value
is where the problem is. Normally I'd hard code a field name in there
such as shown in the commented out line (Field name is Alexander) but
I don't know what field I want until the person picks that from the
form. So how do I input a variable into: miles_value = mileObj(" &
Departure_point_value & ").Value I tired this but doesn't like the
sytex. What am I doing wrong?? Below is shown the code. Thanks!
Arrival_point_value = Request.Form("Arrival_point")
Departure_point_value = Request.Form("Departure_point")
Set schConn = Server.CreateObject("ADODB.Connection")
schConn.Open Application("cwvo_ConnectionString")
Server.ScriptTimeOut = 600
Set mileObj = schConn.Execute("SELECT " & Departure_point_value & "
FROM Mileage_Chart WHERE Location_name = '" & Arrival_point_value &
"' ")
If mileObj.EOF <> true then
' miles_value = mileObj("Alexander").Value
miles_value = mileObj(" & Departure_point_value & ").Value
Response.write "<font face=""arial,helv"" size=""3"">The mileage from
your departure point: " & Departure_point_value & " to arrival point "
& Arrival_point_value & " is: <B>" & miles_value & " </B>miles <P>"
End IF