Results 1 to 8 of 8

Thread: Lookup question

  1. #1
    Join Date
    Mar 2004
    Location
    Dallas, TX
    Posts
    15

    Unanswered: Lookup question

    I have an unbound Text box that I want employees to be able to type in there intials and pull the record based on that search. I dont want to put in a combo box or anything like that, can someone help me with this? Thanks, James

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Why don't you want to use a combobox? The methods for implementing this on a text box is more complicated then on a combobox, but it's perfectly doable.

    You could locate the record in your form's datasource by putting some code in the On Enter event of your field that would filter and requery to form. The basic syntax for the filter is going to be:

    "yourField LIKE '*" & Initials & "*'"

    I assume you have a continous form or something of the like setup here, as it's possible for two different people to have the same intials.

  3. #3
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    By "pull the record based on that search" what do you want to happen ?

    On the AfterUpdate of the unbound textbox, you can cause something to happen, based upon the entry in the textbox.

    The question is, what do you want to happen after it finds this record ?

    Return the entire record ? If so, where ?

    Return a single value ?
    Ken

    Maverick Software Design

    (847) 864-3600 x2

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Lookup question

    Originally posted by James4582
    I have an unbound Text box that I want employees to be able to type in there intials and pull the record based on that search. I dont want to put in a combo box or anything like that, can someone help me with this? Thanks, James

    Private Sub MyTextBox_AfterUpdate()

    MyTextBox.Value=dLookUp("[MyFieldName]","MyTableName","[MyFieldName] LIKE '%" & MyTextBox.Value & "%'")

    End Sub


    Next question ...

  5. #5
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    Mr. Owen, my next question is:

    since when is a % sign valid syntax for the DLookUp command ?
    Ken

    Maverick Software Design

    (847) 864-3600 x2

  6. #6
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Originally posted by PracticalProgram
    Mr. Owen, my next question is:

    since when is a % sign valid syntax for the DLookUp command ?
    He's probably used to an adp.

  7. #7
    Join Date
    Mar 2004
    Location
    Dallas, TX
    Posts
    15
    When they open the form it shows the first record in a line of about 5 or 6 records (single form format). I want that person to be able to type in their initials and then hit the enter key and it will then show them the record they are currently working on. Hope this helps, Thanks.


    Originally posted by PracticalProgram
    By "pull the record based on that search" what do you want to happen ?

    On the AfterUpdate of the unbound textbox, you can cause something to happen, based upon the entry in the textbox.

    The question is, what do you want to happen after it finds this record ?

    Return the entire record ? If so, where ?

    Return a single value ?

  8. #8
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by PracticalProgram
    Mr. Owen, my next question is:

    since when is a % sign valid syntax for the DLookUp command ?
    Ah you caught me ... I forgot that DLookUp is an exact match function ... Ok, scotch the LIKE ... and replace with an "=" sign.

Posting Permissions

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