Results 1 to 5 of 5
  1. #1
    Hardhat4u is offline Novice
    Windows 7 64bit Access 2002
    Join Date
    Dec 2013
    Location
    Sacramento, CA by way of Boston, MA
    Posts
    8

    DatePart syntax in VB querying an SQL table

    What I'm trying to do is convert a year into an integer. The date is in a SQL database and I am using VB to extract the year. The following is only part of the query but I am certain this is the problem area. The error message I receive is "To few parameters, expected 1."

    Here's part of the query that seems to be where the problem lies. In the immediate window it recognizes Date but not 'yyyy'.



    CInt(DatePart('yyyy', Date))

  2. #2
    Hardhat4u is offline Novice
    Windows 7 64bit Access 2002
    Join Date
    Dec 2013
    Location
    Sacramento, CA by way of Boston, MA
    Posts
    8
    I no longer believe that's may problem. It's another parameter giving me that message.

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    That often means something misspelled.

  4. #4
    Hardhat4u is offline Novice
    Windows 7 64bit Access 2002
    Join Date
    Dec 2013
    Location
    Sacramento, CA by way of Boston, MA
    Posts
    8
    You're correct

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    If you've resolved this issue then go ahead and use the Thread Tool and mark this thread as Solved.

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

Similar Threads

  1. datepart in sql string
    By Dannasoft in forum Queries
    Replies: 1
    Last Post: 12-19-2012, 04:52 PM
  2. Querying for the last record of a table
    By Reaper in forum Queries
    Replies: 7
    Last Post: 11-04-2011, 04:27 PM
  3. Replies: 5
    Last Post: 07-18-2011, 06:07 PM
  4. Repeating dates, DateAdd/DatePart
    By Lauren1989 in forum Queries
    Replies: 5
    Last Post: 04-14-2011, 03:28 PM
  5. iff(datepart..
    By pranvera in forum Access
    Replies: 4
    Last Post: 11-19-2010, 11:38 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