Results 1 to 4 of 4
  1. #1
    jgelpi16 is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544

    Question DLookup() syntax????

    I cannot seem to understand why I am getting an error on my Dlookup() as well as my Append query. Syntax looks fine to me. Help will be much appreciated as I'm too frustrated to think clearly. Thanks in advance!



    Dlookup()
    Code:
        Dim db As DAO.Database
        Dim rs As DAO.Recordset
        Dim rs1 As DAO.Recordset
        Dim rs2 As DAO.Recordset
        
        Dim lngEmplID As Long, dblPctException As Double, dblNumWksExempt As Double, dblNumWksExceptions As Double, i As Integer
        Dim mySQL As String, strEmplID As String, strFunDesc As String
        Dim dtExceptionDate As Date, dtEffStartDate As Date, dtEffEndDate As Date, dtFunDate As Date
    On Error GoTo ErrorHandler
    
        Set db = CurrentDb
        strFunDesc = "funRedYelGreen"
        dtFunDate = DLookup("FunDate", "tblFunctions", "[FunDesc] = '" & strFunDesc & "';")
    Append Query in the same function...
    Code:
    ErrorHandler:
        mySQL = "INSERT INTO tblErrorLog([ErrorDesc], [ErrorNumber], [FunDesc]) VALUES('" & Err.Description & "', " & Err.Number & ", '" & strFunDesc & "');"
        CurrentDb.Execute mySQL
    Both are giving me the error:
    "Run-time error '3075': Syntax error in query expression..."

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    No semi-colon ";" in the DLookup() syntax.

  3. #3
    jgelpi16 is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544
    Thanks. Really helps to have a second pair of eyes!

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    That's why we're here!

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

Similar Threads

  1. dlookup help
    By gsantacruz in forum Programming
    Replies: 9
    Last Post: 10-11-2010, 11:46 AM
  2. DLookup()
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 09-15-2010, 07:20 AM
  3. Incomplete Syntax Clause (syntax error)
    By ajetrumpet in forum Programming
    Replies: 4
    Last Post: 09-11-2010, 10:47 AM
  4. Please help SQL Syntax
    By jordanturner in forum Access
    Replies: 4
    Last Post: 09-02-2010, 08:05 AM
  5. dlookup() syntax
    By markjkubicki in forum Programming
    Replies: 4
    Last Post: 08-24-2010, 12:31 PM

Tags for this Thread

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