Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Jun 2004
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Query help (2003)

    Subject edited by HansV to correct spelling error

    I have a query that i want to run which will return a value in a text box. I want to look through a table and return all values that are in the format of xx998A where the xx is either 06 or 07. I can get it to work by hard coding the year, but i want it to be dynamic. Below is the like critera of my query. Job number is the field in the table and txttempyear is the value of the year which is 06 in this case. Any help is appreciated.

    HAVING (((Left([job number],2))="txttempyear") AND ((Right([job number],4)) Like "998A"));

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Query help (2003)

    I'm not sure I understand what you are trying to do. Do you want all records for which the first two characters of ]job number] are equal to the value of txttempyear? And what is txttempyear? A text box on a form? If so, what is the name of the form? Or is it a variable in VBA code? Or something else.

  3. #3
    2 Star Lounger
    Join Date
    Jun 2004
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Query help (2003)

    Yes, I want the first two characters of job number to be equal to txttempyear which is a text box on the form i am using. I believe it is a variable in VBA code.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Query help (2003)

    Try
    <code>
    HAVING [job number] = [Forms]![frmSomething]![txttempyear] & "998A"
    </code>
    where fromSomething is the name of the form.

  5. #5
    2 Star Lounger
    Join Date
    Jun 2004
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Query help (2003)

    Thanks Hans. You are the man!

Posting Permissions

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