Solved

Adding wildcard to criteria in a query when requesting data from form

Posted on 2011-09-19
3
282 Views
Last Modified: 2012-05-12
I have a query that is getting its criteria from a form.
Between [Forms]![frmView]![txtPROCF] And [Forms]![frmView]![txtPROCT] Or Is Null
I need to be able to add a wilcard to the beginning of txtPROCF and PROCT in the query.  Can this be done and if yes what is the syntax?
0
Comment
Question by:ScootterP
3 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 250 total points
ID: 36562138
you have to use "Like" instead of Between

Where [FieldName] Like "*" & [Forms]![frmView]![txtPROCF] And [FieldName] Like "*" & [Forms]![frmView]![txtPROCT]
0
 
LVL 11

Assisted Solution

by:datAdrenaline
datAdrenaline earned 250 total points
ID: 36562531
You can not use a wildcard in a BETWEEN .. AND .. operator.  Also, how you can look for BETWEEN when the query process will not know what the beginning of the text will be?  Remember BETWEEN will use an alphanumeric sorting algorithm on text fields, so you have to give it the starting letters.  However, just as cap is aluding to, you need to use a LIKE operator, but you can use that in conjuction with your BETWEEN ...

WHERE ((someTextField Between [Forms]![frmView]![txtPROCF] And [Forms]![frmView]![txtPROCT])
      And (someTextField LIKE "[a-c]*"))
      Or (someTextField Is Null)

The above criteria above will return all the records with Null in someTextField or (someTextField starts with a, b, or c AND is between your parameters)
0
 

Author Closing Comment

by:ScootterP
ID: 36563725
Got  it to work with some manipulation.  Thanks.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now