criteria 'between' value 1 and Value 2 only

E

efandango

I have a query that uses criteria to pick from a a range of postcodes from
two combo boxes; like this:

Between [Forms]![frm_Runs].[cbo_Point2Point_Postcode_From] And
[Forms]![frm_Runs].[cbo_Point2Point_Postcode_To]

the problem is that, If say I pick

FROM postcode: E1
TO Postcode: E7

it will quite rightly give me E1, E2, E3, and so on...

So I don't really want them to be 'Between' in the MS Access sense.

What I want is only the Postcodes from E1 and E7, exluding all the others,
and I need these two postcode values to go into the single field,
[Run_Point_Postcode] which in turn, will Append to a table.


Can it be done?, am I overlooking something simple here, or have I been
sitting in front of my PC for too long?...


MY SQL:

SELECT DISTINCTROW TOP 18 (select count(subtable.Point_ID)+1 from tbl_Points
as subtable where subtable.Point_ID < tbl_Points.Point_ID and
(((subtable.Run_No) Between [Forms]![frm_Runs].[cbo_Point2Point_From] And
[Forms]![frm_Runs].[cbo_Point2Point_To]))) AS recordnum, tbl_Points.Run_No,
tbl_Points.Run_point_Venue, tbl_Points.Run_point_Address,
tbl_Points.Run_Point_Postcode
FROM tbl_Points
WHERE (((tbl_Points.Run_Point_Postcode) Between
[Forms]![frm_Runs].[cbo_Point2Point_Postcode_From] And
[Forms]![frm_Runs].[cbo_Point2Point_Postcode_To]) AND
((tbl_Points.Custom_Point)=0))
ORDER BY Rnd([tbl_Points.Point_ID]);
 
R

ruralguy via AccessMonster.com

How about:
WHERE ((tbl_Points.Run_Point_Postcode) =
[Forms]![frm_Runs].[cbo_Point2Point_Postcode_From] OR
(tbl_Points.Run_Point_Postcode) =
[Forms]![frm_Runs].[cbo_Point2Point_Postcode_To])
I have a query that uses criteria to pick from a a range of postcodes from
two combo boxes; like this:

Between [Forms]![frm_Runs].[cbo_Point2Point_Postcode_From] And
[Forms]![frm_Runs].[cbo_Point2Point_Postcode_To]

the problem is that, If say I pick

FROM postcode: E1
TO Postcode: E7

it will quite rightly give me E1, E2, E3, and so on...

So I don't really want them to be 'Between' in the MS Access sense.

What I want is only the Postcodes from E1 and E7, exluding all the others,
and I need these two postcode values to go into the single field,
[Run_Point_Postcode] which in turn, will Append to a table.

Can it be done?, am I overlooking something simple here, or have I been
sitting in front of my PC for too long?...

MY SQL:

SELECT DISTINCTROW TOP 18 (select count(subtable.Point_ID)+1 from tbl_Points
as subtable where subtable.Point_ID < tbl_Points.Point_ID and
(((subtable.Run_No) Between [Forms]![frm_Runs].[cbo_Point2Point_From] And
[Forms]![frm_Runs].[cbo_Point2Point_To]))) AS recordnum, tbl_Points.Run_No,
tbl_Points.Run_point_Venue, tbl_Points.Run_point_Address,
tbl_Points.Run_Point_Postcode
FROM tbl_Points
WHERE (((tbl_Points.Run_Point_Postcode) Between
[Forms]![frm_Runs].[cbo_Point2Point_Postcode_From] And
[Forms]![frm_Runs].[cbo_Point2Point_Postcode_To]) AND
((tbl_Points.Custom_Point)=0))
ORDER BY Rnd([tbl_Points.Point_ID]);
 
J

John W. Vinson

I have a query that uses criteria to pick from a a range of postcodes from
two combo boxes; like this:

Between [Forms]![frm_Runs].[cbo_Point2Point_Postcode_From] And
[Forms]![frm_Runs].[cbo_Point2Point_Postcode_To]

the problem is that, If say I pick

FROM postcode: E1
TO Postcode: E7

it will quite rightly give me E1, E2, E3, and so on...

So I don't really want them to be 'Between' in the MS Access sense.

What I want is only the Postcodes from E1 and E7, exluding all the others,
and I need these two postcode values to go into the single field,
[Run_Point_Postcode] which in turn, will Append to a table.

I'm not sure I understand. Aren't postcodes (where are you, anyway - England?
Canada?) longer than two bytes, with a region code and a more specific code?

Please give an example of the type of data you're searching and the desired
output.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top