Between

  • Thread starter Thread starter www jjj fff
  • Start date Start date
W

www jjj fff

Chey said:
I have a table that I am using, I have a list of codes
ex
06CA06001 all the way to 06CA06399
In my query under critera I was to write something to where it only shows
06CA06001-06CA099 and 06CA06300-06CA06399
How do I do that I tried bewteen but realized that didn't work.
So in my new form I only want those records visable.
Thanks
Chey
 
I have a table that I am using, I have a list of codes
ex
06CA06001 all the way to 06CA06399
In my query under critera I was to write something to where it only shows
06CA06001-06CA099 and 06CA06300-06CA06399
How do I do that I tried bewteen but realized that didn't work.
So in my new form I only want those records visable.
Thanks
Chey
 
Hi Chey,

Have you tried something like this?

SELECT Field1, Field2, Field3
FROM TableName
WHERE Not ((
Code:
) Between '06CA100' And '06CA06299')


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
 
Tom would like to retract the previous reply.


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________


Tom Wickerath said:
Hi Chey,

Have you tried something like this?

SELECT Field1, Field2, Field3
FROM TableName
WHERE Not ((
Code:
) Between '06CA100' And '06CA06299')


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________


[QUOTE="Chey"]
I have a table that I am using,  I have a list of codes
ex
06CA06001  all the way to 06CA06399
In my query under critera I was to write something to where it only shows
06CA06001-06CA099 and 06CA06300-06CA06399
How do I do that  I tried bewteen but realized that didn't work.
So in my new form I only want those records visable.
Thanks
Chey[/QUOTE][/QUOTE]
 
One more try. How about this?

SELECT TableName.Field1, TableName.Field2, TableName.Field3
FROM TableName
WHERE (((Val(Mid(
Code:
,5))) Not Between 100 And 6299));



Tom

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________


[QUOTE="Tom Wickerath"]
Tom would like to retract the previous reply.


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________


[QUOTE="Tom Wickerath"]
Hi Chey,

Have you tried something like this?

SELECT Field1, Field2, Field3
FROM TableName
WHERE Not (([Code]) Between '06CA100' And '06CA06299')


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________


[QUOTE="Chey"]
I have a table that I am using,  I have a list of codes
ex
06CA06001  all the way to 06CA06399
In my query under critera I was to write something to where it only shows
06CA06001-06CA099 and 06CA06300-06CA06399
How do I do that  I tried bewteen but realized that didn't work.
So in my new form I only want those records visable.
Thanks
Chey[/QUOTE][/QUOTE][/QUOTE]
 
if the last five digits of the values are always numeric, try adding a
calculated field in your query, as

NumVal: CLng(Right(FieldName, 5))

replace FieldName with the correct name of the field, of course. then add
criteria to the calculated field, as

Between 6001 and 6099 Or Between 6300 And 6399

hth
 
Hi Chey,

It looks like you might have a typo. Three of the codes are char length 9;
the second is length 7. Shouldn't it be 06CA06099??
06CA06001-06CA099 and 06CA06300-06CA06399
^^


You want to see all records where the code is

BETWEEN 06CA06001 AND 06CA06099

OR

BETWEEN 06CA06300 AND 06CA06399


It that is what you want, try this query:

(change the field(s) and table name - watch for line wrap!)


SELECT tblcode.Code
FROM tblcode
WHERE (((tblcode.Code) Between '06CA06001' And '06CA06099' Or (tblcode.Code)
Between '06CA06300' And '06CA06399'))
ORDER BY tblcode.Code;


HTH
 
Perfect thanks

SteveS said:
Hi Chey,

It looks like you might have a typo. Three of the codes are char length 9;
the second is length 7. Shouldn't it be 06CA06099??

^^


You want to see all records where the code is

BETWEEN 06CA06001 AND 06CA06099

OR

BETWEEN 06CA06300 AND 06CA06399


It that is what you want, try this query:

(change the field(s) and table name - watch for line wrap!)


SELECT tblcode.Code
FROM tblcode
WHERE (((tblcode.Code) Between '06CA06001' And '06CA06099' Or (tblcode.Code)
Between '06CA06300' And '06CA06399'))
ORDER BY tblcode.Code;


HTH
 
I guess I don't understand.
I have my query am I suppose to do this is sql?
If so I know to place the code there, then what?
 
Back
Top