Results 1 to 8 of 8
  1. #1
    cebrower is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2018
    Location
    Spring Lake, MI
    Posts
    110

    Invalid procedure call


    I'm using the DatePart function in a query to return records where the required ship date is in the current year. This query has worked fine until today. Now I get an error message that reads Invalid procedure call. If I delete the field, the query runs fine. Any suggestions? See attached.
    Attached Thumbnails Attached Thumbnails Invalid call.JPG  

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Open the VBA editor and see if there is a missing library reference. If there is, try to reselect.

    Run Compact & Repair.
    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
    cebrower is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2018
    Location
    Spring Lake, MI
    Posts
    110
    I've decompiled, recompiled, run compact and repair, removed and replaced field. No luck. What library would I be missing? The Sum() function works OK.

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    This can happen if any of the records in the field are Null. Suggest you check that.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Tested with null field. No issue.

    Try:

    Year([ReqShipDate])

    Year(Date())

    I suspect DatePart() is a VBA function and Sum() is SQL.

    Weirdness is often corruption that can't be fixed.
    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.

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Tested with null field. No issue.
    Another false memory, I guess

    Looking again at the query grid, where's the field alias for the DatePart function field? Methinks you cannot have a function as a field name? I tried but can't - design window won't even allow it.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    In my test, query automatically adds Expr1 as the field alias as soon as I click away from the cell. It is odd the image does not show that.

    So manually type in a fieldname:

    Yr: Year([ReqShipDate])
    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.

  8. #8
    cebrower is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2018
    Location
    Spring Lake, MI
    Posts
    110
    Turns out there was a corrupted record in tblHeader (Chinese characters) so the DatePart function did not recognize the contents of the field as a date. Got rid of the corrupt record and it works just fine. By the way, I did have an alias for the DatePart field, but Access stripped it when I closed and reopened the query. Thank you all for your suggestions.

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

Similar Threads

  1. Invalid procedure call
    By RonL in forum Queries
    Replies: 0
    Last Post: 05-16-2016, 02:19 PM
  2. Invalid Procedure Call or Argument
    By Trojnfn in forum Access
    Replies: 2
    Last Post: 10-29-2012, 01:44 PM
  3. Dedupe Query - Invalid Procedure Call
    By icarus in forum Queries
    Replies: 0
    Last Post: 12-07-2011, 08:49 AM
  4. Invalid Procedure Call
    By neo651 in forum Queries
    Replies: 21
    Last Post: 09-11-2011, 12:58 PM
  5. invalid procedure call
    By johnmerlino in forum Access
    Replies: 5
    Last Post: 12-13-2010, 10:12 AM

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