Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Mar 2001
    Location
    Texas
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using a calculate field as a select criteria (Access97)

    I'm trying to input a string in a calculated field:

    Expr1:[Enter Old Company Name: ] & "*"

    I'd like to use Expr1 as the select criteria for a column name Old_Company in the same query. I can't get it to work. Is this possible or do I have to go to a form to input it, do a 'like' query and then show the result set on the form?

    Thanks,

    Mary

  2. #2
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using a calculate field as a select criteria (Access97)

    I'm not sure what you are trying to accomplish with [Enter Old Company Name: ] & "*". Is this a query parameter? If you want the parameter to select all if no value is typed in the parameter window, use Like [Enter Old Company Name: ] Or Like "*". If you want to just type the start of the value in the parameter window, use Like [Enter Old Company Name: ] & "*".
    I didn't get the part about the calculated field ... how does that apply?

  3. #3
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    London, Ontario, Canada
    Posts
    437
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using a calculate field as a select criteria (Access97)

    Mary,
    You don't need the expression, just enter Like [Enter Old Company Name: ] & "*" in the Criteria grid.

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Using a calculate field as a select criteria (Access97)

    I'm guessing you are trying to use Expr1 as the selection critieria for old_company? Which, unfortunately doesn't work; that is, you can't use Expr1 anywhere else in the query.

    So, just eliminate that column in the query that has Expr1: [Enter.......]. Instead, just put the following in the selection critieria of old_company:
    Like [Enter company name] & "*"
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Using a calculate field as a select criteria (Access97)

    It isn't clear where the expression is going, but I assume that's an expression field in a query under your form.

    There's no point in putting the asterisk in the expression if it is simply a calculated field in the query and you want the parameter value to show up in each record. Just the [Enter Old Company Name:] will be adequate for the expression.

    There is good reason to concatenate it to the parameter in the criteria line, though, but you would do that like this:

    Like [Enter Old Company Name: ] & "*"

    You have to enter the full parameter in square brackets everywhere in the query that you want it evaluated.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •