Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2002

    Unanswered: Help with dlookup function

    I wat to use the dlookup function to get the first (and only) record in a table.

    I have the following code in an onclick event of a command button:

    Dim Stfrmt as String

    stFrmt = DLookup("field name", "table name")
    MsgBox stFrmt

    I get an error saying there is no current record.

    When this code runs a query is open based on different tables. I'm thinking I have to set the recordset to this table but don't know the syntax.

    THanks in advance

  2. #2
    Join Date
    Jun 2004
    Dim Stfrmt As String
    Stfrmt = DLookup("[field name]", "table name")
    MsgBox Stfrmt
    With the exception of the field and table names this is the exact code that I tested in a button. It worked properly so the problem isn't in the code you provided.

  3. #3
    Join Date
    Dec 2004
    only thing he was missing were the brackets around the field name

Posting Permissions

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