Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I tried your query without the <code>select *</code>, and without the <code>FROM</code> and <code>ORDER BY</code> clauses. I added in an extra column into the <code>SELECT</code> to prove that strings return as left-justified in access's grid.</p> <pre><code>SELECT Int((3963*(Atn(-( Sin(LATITUDE/57.2958)*Sin([@lat]/57.2958)+Cos(LATITUDE/57.2958)* Cos([@lat]/57.2958)*Cos([@lng]/57.2958-LONGITUDE/57.2958))/Sqr(-(Sin(LATITUDE/57.2958)* Sin([@lat]/57.2958)+Cos(LATITUDE/57.2958)*Cos([@lat]/57.2958)* Cos([@lng]/57.2958-LONGITUDE/57.2958))*(Sin(LATITUDE/57.2958)* Sin([@lat]/57.2958)+Cos(LATITUDE/57.2958)*Cos([@lat]/57.2958)* Cos([@lng]/57.2958-LONGITUDE/57.2958))+1))+2*Atn(1)))*10)/10 AS Distance, 'test' as test </code></pre> <p>I was prompted for four parameters, but in the end, I got back a two-column table:</p> <p><img src="https://i.stack.imgur.com/AKmCR.png" alt="enter image description here"></p> <p>Since the first column in right-justified, and the second (clearly a string) is left-justified, it appears that access is indeed returning it as a numeric for me. This was in Access 2010.</p> <p>--<strong>EDIT</strong>--</p> <p>I just created a new two-column table called <code>Locations</code>. It has a field <code>id</code> (autonumber) and a field <code>Field1</code> (text). I ran the original query provided by OP and it works fine (distance is returned as a number).</p> <p>This leads to wonder... Does the OP's <code>Locations</code> table have it's own Distance field, that is a string? Otherwise, the problem has got to be in the code calling the SQL statement, not in the statement or the jet engine itself.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload