Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 24th, 2004, 02:48 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Norwich, Norfolk, United Kingdom.
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default Query Criteria

I have a query field comprising a text string of seven digits, eg 2220603.

The following criteria works ok, as does replacing the wild card groups with, eg, the contents of a text box.

Like "???" & "06" & "??"

But how can I make the middle group something like >=06 please/


Clive Astley
__________________
Clive Astley
  #2 (permalink)  
Old March 24th, 2004, 03:11 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Location: Clarksville, TN, USA.
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

use hte mid function
Mid([Fieldname],4,2)

4 is the beginning of the string, 2 is the length

then check if value >06



Sal
  #3 (permalink)  
Old March 24th, 2004, 07:43 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Norwich, Norfolk, United Kingdom.
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Sal. That's ok for just testing the middle bit. But how do I join it to the other two tests?

Like "222" & Mid([FieldName],4,2)>06 & "04"

doesn't work.

Clive Astley
  #4 (permalink)  
Old March 24th, 2004, 11:19 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Location: Clarksville, TN, USA.
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sounds like you are trying to do this

Left([FieldName],3) and
Mid([FieldName],4,2)>06 and
right([FieldName]),2)="04"

You are looking for all 3 to be true. Is that right?

Anyway, search the Access help for "Expresions". There you can lookup the expressions for text.



Sal
  #5 (permalink)  
Old March 25th, 2004, 03:27 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Norwich, Norfolk, United Kingdom.
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks again Sal. Got it now. Don't know why I had the difficulty with it; have used similar in the past. I seem to have got into the mindset of using the Like operator. Senior moments of old age! Thanks again and best wishes,

Clive Astley


Similar Threads
Thread Thread Starter Forum Replies Last Post
Expressions in query criteria thedom Access 2 December 13th, 2007 04:33 PM
ListBox as Query criteria? PubliusHJM Access 8 August 28th, 2007 06:14 AM
Conditional criteria in query dfuas BOOK: Beginning Access VBA 0 January 15th, 2006 03:19 PM
Criteria in Query lryckman Access 1 June 23rd, 2004 11:11 AM
Append Query Criteria Ben Access 1 January 21st, 2004 07:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.