Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2011

    Unanswered: Dlookup from a table

    I have a table which I would like one of its field to be displayed in a textbox from a table.
    Ive tired the DLookup and no matter what I just get #Name? in the box, is my syntax wrong ??
    = DLookup("[SUNDAY]", "Totals", "[TYPE]='GENERAL'")
    = DLookup("[Totals]![SUNDAY]", "[Totals]", "[Totals]![TYPE]='GENERAL'")
    I’ve tired the above statements

  2. #2
    Join Date
    Mar 2010
    If your table is called "Totals" and you have fields in the table called "SUNDAY" and "Type" then how about


  3. #3
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    assuming that you have a table called 'Totals' and it has a column called 'SUNDAY' and a column called 'TYPE' that should work

    there is no need to include the table name if its coming from one table
    there is no need to include the square brackets if the column and or table name don't include spaces
    the separator between table and column names should be a '.'
    table.columnname not table!columnname

    = DLookup("SUNDAY", "Totals", "TYPE='GENERAL'")

    if you are getting #name that suggests you have mistyped somethign or included a column / table that doesn't exist

    given that you have a table called 'totals', a column called 'sunday' I fervently hope neither exists as at first glance it looks like a table that violates normalisation
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Mar 2009
    Provided Answers: 15
    If the name of the table is Totals, the name of the column from where you want to retrieve the data is SUNDAY and the name of the column that must contain the word GENERAL is TYPE, then the proper syntax is:
    Me.MyTextBox.Value = DLookup("SUNDAY", "Totals", "TYPE = 'GENERAL'")
    Have a nice day!

  5. #5
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    In addition to everything else, you need rename the Field named 'Type' as 'Type' is a Reserved Word in Access and using it as an Object or Field name can cause all kinds of problems!

    'General' is also a Reserved Word, but is being used as a Value here, not as a name, which is, of course, all right!

    Linq ;0)>
    Hope this helps!

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

    All posts/responses based on Access 2003/2007

Posting Permissions

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