Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    513

    dlookup syntax

    ok... its getting late, I'm tired...
    I'm sure it will be obvious, but I just don't see the error

    =DLookUp([tbeSubIssueSchedule_Types]![type],[tbeSubIssueSchedule_Types],[Type]="""&[Forms]![frmSpec]![txtType]&""")

    where


    [type] is a valid string field in the valid table [tbeSubIssueSchedule_Types] (yes, I know "type" is not a good name... but I inherited it)
    and the expression [Forms]![frmSpec]![txtType] generates a valid string response

    -------
    ultimately, I'm looking to include it in the control source for a checkbox (it's complicated why...)
    the control source would be =
    iff(isnull(DLookUp([tbeSubIssueSchedule_Types]![type],[tbeSubIssueSchedule_Types],[Type]="""&[Forms]![frmSpec]![txtType]&""")),false,true)
    does that seem right to you too?

    many thanks in advance,
    Mark

  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,625
    Arguments must be within quote marks, unless they are variables.

    =DLookUp("[Type]", "[tbeSubIssueSchedule_Types]", "[Type]='" & [Forms]![frmSpec]![txtType] & "'")

    Why are you looking up Type when you already have Type?
    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
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    513
    you actually noted a different problem... there are (2) criteria that need to be met

    =DLookUp("[Type]","[tbeSubIssueSchedule_Types]","[Type]='" & [Forms]![frmSpec]![txtType] & "'" And "[SubIssueTitle]='" & [me].[txtSubIssueTitle] & "'")

    here's the bigger mess
    I have a table of Lamp_Types (or whatever)
    and I need to be able to filter the report of Types based on whether or not they are included in an order
    on the same form that the Types are entered is a subform with a list of all the orders that exist onto which they COULD be added
    also on that subform, next to each order is a checkbox - if the record is already included, it will be checked, if not...

    if the user clicks the checkbox, code will check to see if the record is already in a table that incudes a list of Types and what orders they are included in (it is related to the table of LampTypes and a table of Orders
    ... code will them delete the Type from the table if it is already there, or add it if it is not, and then requery the subtable

    complicated -yes? (but I can't think of a way around it -UGH)

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Correct syntax for the DLookup is:

    DLookUp("[Type]", "[tbeSubIssueSchedule_Types]", "[Type]='" & [Forms]![frmSpec]![txtType] & "' And [SubIssueTitle]='" & Me.[txtSubIssueTitle] & "'")
    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.

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

Similar Threads

  1. Dlookup syntax
    By crowegreg in forum Programming
    Replies: 2
    Last Post: 03-05-2014, 06:00 PM
  2. DLookup Syntax Error
    By uncletreetrunk in forum Programming
    Replies: 4
    Last Post: 07-30-2012, 02:29 PM
  3. IIf and dlookup syntax
    By AndycompanyZ in forum Forms
    Replies: 3
    Last Post: 06-28-2011, 02:47 PM
  4. DLookup() syntax????
    By jgelpi16 in forum Programming
    Replies: 3
    Last Post: 03-30-2011, 09:14 AM
  5. dlookup() syntax
    By markjkubicki in forum Programming
    Replies: 4
    Last Post: 08-24-2010, 12:31 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