Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2006
    Posts
    9

    Unanswered: Form Dlookup Cbo value

    Hi,

    I am attempting Dlookup in a textbox in FrmSales.

    When I use this,
    Code:
    =DLookUp("[Price]","TblProduct","[Product]='" & [Forms]![FrmSales]![CboProduct] & "'")
    I get no return, but when I use this
    Code:
    =DLookUp("[Price]","TblProduct","[Product]='" & "Red" & "'")
    I get the proper results.

    CboProducts is a combobox with the selection Red,Green,Blue and any of the three words hardcoded in the formula gets the correct results.

    What am I missing ?

    Thanks
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    put a breakpoint / watch on the code and see what value [Forms]![FrmSales]![CboProduct] is

    https://www.google.co.uk/#output=sea...w=1745&bih=904

    my expectation is that the runtime is interpreting [Forms]![FrmSales]![CboProduct] as the object not a value
    so specify the correct property which will probably be .text or .value or .selected
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Oct 2006
    Posts
    9
    Thanks healdem,

    I ran this in the imediate window
    Code:
    ?DLookUp("[Price]","TblProduct","[Product]='" & [Forms]![FrmSales]![CboProduct] & "'")
    The value return was "Null"

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    ok so what was the value of [Forms]![FrmSales]![CboProduct]?

    After all you all ready knew that the value of the overall expression was nothing
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    My guess would be, as healdem is suggesting, I believe, that the Bound Column of CboProduct is not what you think it is.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    995
    Provided Answers: 2
    Had a value actually been selected in the combo box?
    10% of magic is knowing something that no-one else does. The rest is misdirection.

  7. #7
    Join Date
    Oct 2006
    Posts
    9
    Ok, Thanks.

Posting Permissions

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