Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2006
    Posts
    5

    Unanswered: Populating a textbox from a Select statement...

    Hello All,

    I'm a long-time member, but never posted that i can remember. I'm having an issue with populating a text box on a form with data retrieved from the following select statement. Can someone please tell me what I'm doing wrong or if this is doable at all?

    I'm using this select statement as the control source on a text box. When i go into Form View, field only shows "#Name?".

    =(Select Rate FROM TBL_Labor WHERE Routing="F30")

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    Has this worked for you in the past? I wouldn't think that would work. The SELECT statement is returning a recordset and you are trying to assign the recordset to a text box.

    If you are certain it is only returning one value then you could use DLookup. If you want tio show more than one value then I think you will need a subform.

  3. #3
    Join Date
    Jul 2006
    Posts
    5
    In all honesty, this is the first time I've attempted such a thing. I've been googling with no success. The Dlookup should work as i am only returning one value, but i've never attempted it either. Do you have an example of what it should look like based upon my query above?

  4. #4
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I personally don't use DLookups, but from the help I would think the call would look like:

    =DLookup("[Rate]","TBL_Labor","[Routing]=F30")

  5. #5
    Join Date
    Jul 2006
    Posts
    5
    Hmmm...it's giving an error. It flashes #error to be more precise.
    Last edited by clayguthrie29; 04-21-08 at 15:06.

  6. #6
    Join Date
    Jul 2006
    Posts
    5
    Between playing with this code and more googling, I've found my answer. It works great. Thanks for all of your help!

    =DLookUp("Rate","TBL_Labor","Routing='F30'")

  7. #7
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    Yeah, it was the single quotes around the F30.

Posting Permissions

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