No Value Given for one or more required Parrameters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • iheartvba
    New Member
    • Apr 2007
    • 171

    No Value Given for one or more required Parrameters

    Hi Everyone,
    I have been using access query builder for a while now and want to perfect my SQL coding. I am trying to run this query in VBA but it gives the following error: Run-time error '-21427217904 (80040e10)': No Value Given for one or more required Parrameters.

    Code:
    strSQLStartNullEndNull = "SELECT Date, UserID, TimeEnd, TimeIn " & _
    "FROM tblTimeCard " & _
    "WHERE Date= " & Date & " AND UserID = " & CurrentUser & _
    " AND TimeEnd Is Not Null AND TimeIn Is Not Null"
    Set cnn = CurrentProject.Connection
    rst.Open strSQLStartNullEndNull, cnn, adOpenDynamic, adLockOptimistic
    I pasted this same query in access query builder and it works perfectly this is what the code was:
    Code:
    SELECT Date, UserID, TimeEnd, TimeIn FROM tblTimeCard WHERE Date=  Date () AND UserID = CurrentUser () AND TimeEnd Is Not Null AND TimeIn Is Not Null
  • FishVal
    Recognized Expert Specialist
    • Jun 2007
    • 2656

    #2
    Hello, iheartvba.

    The following stuff may be helpful for you.
    Literal DateTimes and Their Delimiters (#).
    Reserved Words in Access, Especially Date and Time

    Regards,
    Fish.

    P.S. SQL expression you've pasted into query builder is well not the same as that the code generates.

    Comment

    • iheartvba
      New Member
      • Apr 2007
      • 171

      #3
      Thanks A Lot, that fixed it, as soon as I saw the solution I remembered I faced with this problem maybe last year. So I am sorry if I have double posted.


      P.S. Keep it up you guys are a salvation to newbie programmers.

      Comment

      • FishVal
        Recognized Expert Specialist
        • Jun 2007
        • 2656

        #4
        You are welcome.

        Best regards,
        Fish.

        Comment

        Working...