Results 1 to 3 of 3
  1. #1
    CTdbdev is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Jul 2014
    Posts
    12

    Textbox using dlookup for Query

    Hello,



    It seems people have beat this subject to death, but I'm still not getting this to work right.
    I have a query that takes several columns from a products table and calculates a result into one of the query columns. In my form I'm trying to display that calculated result (cost) specific to the current ProductID on the form and query.

    I think I'm close, as the following expression no longer generates #error, but it's just a blank box with each record.

    Code:
    =DLookUp("[KitCost]","[KitCostQ]","[ProdPN]= ' " & [Forms]![ProductF]![ProdPN] & " ' ")
    Regards,
    Alex

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Don't put spaces around the apostrophe.

    =DLookUp("[KitCost]","[KitCostQ]","[ProdPN]= '" & [Forms]![ProductF]![ProdPN] & "'")

    Is ProdPN a text type field? If it is number then don't use the apostrophes.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    CTdbdev is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Jul 2014
    Posts
    12
    Oh, oops. I put the spaces in there to make it easier to read when reviewing code.
    It works now, Thanks!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 07-11-2014, 08:13 AM
  2. Replies: 6
    Last Post: 06-09-2014, 12:13 AM
  3. Dlookup with criteria of textbox
    By thescottsman92 in forum Access
    Replies: 3
    Last Post: 08-30-2013, 03:32 AM
  4. Replies: 4
    Last Post: 05-31-2013, 07:00 PM
  5. Copy textbox to textbox from query
    By zduffy in forum Programming
    Replies: 2
    Last Post: 11-08-2012, 02:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums