Results 1 to 9 of 9
  1. #1
    Rick West is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2009
    Posts
    90

    Parameter Query & Wildcard

    I have a parameter query based on DAFItem in a form and want the query to return all DAFItems with that base, so I tried adding a wildcard to the end of the string (see below) but it does not not work.

    If I take the & "*" off the end the query returns only the exact matched DAFItem.

    If I replace this string with a DAFItem* in the criteria of the query it works. (Such as 1234567*) It will return 1234567DAF, 1234567PE, 1234567PET, 1234567ABC, etc.



    Here is the string I am working with now:

    [Forms]![F_DAFPNReview]![F_PartReviewMaster].[Form]![DAFItem] & "*"

    How can I pass this string to the query and a wildcard as well?

  2. #2
    MAF4Fam6's Avatar
    MAF4Fam6 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Location
    Fruit Heights, Utah USA
    Posts
    140

    Post Parameter Query & Wildcard

    I quite don't understand your issue if you say the underlying query works by replacing the string with a DAFItem* in the criteria of the query.
    Why would you want to pass the string to the query in this instance if the query is already filtering this for you when you update the criteria section (which works) in the query?

    RC
    Last edited by MAF4Fam6; 12-26-2009 at 10:01 PM.

  3. #3
    Rick West is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2009
    Posts
    90
    OK, let me try to explain this clearer. If, in the query, on the criteria row, under DAFItem, I type in 1234567* the query will pull all DAFItems beginning with 1234567. This tells me the basic query is sound.

    But I want the query to pull various DAFItems based on whichever DAFItem has focus on a form so I replaced the 1234567* in the query's criteria with this: [Forms]![F_DAFPNReview]![F_PartReviewMaster].[Form]![DAFItem] & "*" but it does not work. It will not add the asterisk to the DAFItem like the 1234567* example above. It returns no data at all.

    So, my question is how to set up the query criteria so it looks at the form, grabs the DAFItem and adds an asterisk?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'm sorry Rick but I do not have a good answer for you. We may have to wait for RC to come back on line.

  5. #5
    MAF4Fam6's Avatar
    MAF4Fam6 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Location
    Fruit Heights, Utah USA
    Posts
    140

    Post Parameter Query & Wildcard

    Hello Rick,
    We may have to filter the query from within the form itself instead of the query.
    Any way you can provide us a down-scale version of your db?
    Thanks.

    RC

  6. #6
    MAF4Fam6's Avatar
    MAF4Fam6 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Location
    Fruit Heights, Utah USA
    Posts
    140

    Post Parameter Query & Wildcard

    Rick,
    I came across this same exact question/issue many years ago which I attempted over and over again to figure out, unfortunately, to no avail. Only difference was I was trying to use a parameter query instead. I wanted the query to ask me the question then add the * to my input. Willing to revisit though.
    Try this in the criteria of the query instead:
    Code:
    Like [Please enter the DAFItem to return ALL DAFItems] & "*"
    Thanks.

    RC

  7. #7
    Rick West is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2009
    Posts
    90
    OK, I got the wildcard criteria working, all I needed to do was add the word "Like" in front of the criteria with the & "*" added to the back, like this:

    Like[Forms]![F_DAFPNReview]![F_PartReviewMaster].[Form]![DAFItem] & "*"

    So now I'm trying to get the criteria to pull any DAFItem with a wildcard in front and back of the DAFItem but it won't do that for me, here is what I'm trying:

    Like[Forms]![F_DAFPNReview]![F_PartReviewMaster].[Form]!"*"& [DAFItem] & "*"

    Appreciate any insights you guys may have on this.

  8. #8
    Rick West is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2009
    Posts
    90
    I got it!!!! yeah. It was a matter of where I was positioning the wildcard in front of the criteria string. I should have put it way in the front, just after the word like - like this:

    Like "*" & [Forms]![F_DAFPNReview]![F_Review].[Form]![ITEM] & "*"

    This criteria now pulls any DAFItem imbedded in all DAFItems even if it has leading or ending numbers/alphas.

    Thanks again for your help. Hope this helps someone else if they have this problem.

  9. #9
    MAF4Fam6's Avatar
    MAF4Fam6 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Location
    Fruit Heights, Utah USA
    Posts
    140

    Post

    Rick,
    Glad we could help.
    If you are ready to mark this thread as "Solved", please go to Thread Tools > Mark This Thread as Solved link.
    Thanks.

    -RC

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Pass a Parameter From a form to a Query
    By DDillesha in forum Forms
    Replies: 1
    Last Post: 10-28-2009, 12:49 PM
  2. Get value typed in for a Parameter query
    By terryvanduzee in forum Forms
    Replies: 1
    Last Post: 10-14-2009, 03:01 AM
  3. Report with Parameter Query/Form
    By maggioant in forum Reports
    Replies: 0
    Last Post: 10-09-2009, 09:48 AM
  4. Parameter in Crosstab Query
    By RandyG in forum Queries
    Replies: 4
    Last Post: 09-30-2009, 06:40 AM
  5. Add combo box to parameter query
    By louisa14 in forum Queries
    Replies: 1
    Last Post: 12-10-2005, 08:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums