+ Reply to Thread
Results 1 to 14 of 14

syntex error in date

  1. #1
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    syntex error in date

    Hi Guys

    The following line gives me the Syntext error message in date in query expression. I think I am using wrong date fomat. But the Scandate in table is stored in yyyymmdd format. e.g 20140624

    the combobox1 stored Day (DD)
    combobox2 stores month (MM)
    combobox3 stores Year (YYYY)
    Please Login or Register  to view this content.
    Thanks

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: syntex error in date

    There should be no spaces after the #.

    Also, you might want to reconsider the format you are using for the date, try yyyy-mm-dd.
    If posting code please use code tags, see here.

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,332

    Re: syntex error in date

    That's probably not a real date value, so you don't need # in there and your order is wrong (should be yyyymmdd not ddmmyyyy).
    Everyone who confuses correlation and causation ends up dead.

  4. #4
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: syntex error in date

    Again the same error message guys. i made the following change:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: syntex error in date

    And also I just noticed that in the table the Scandate has number data type. I thought it was date . So can you please make the changes accordingly please.

    Thanks

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,332

    Re: syntex error in date

    You didn't make any of the changes I mentioned.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: syntex error in date

    There should be no space before or after #.

    Try this.
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: syntex error in date

    Thanks romperstomper, i am writing the following lines of code but they don't copy any data from Access to Excelsheet.
    Please Login or Register  to view this content.

  9. #9
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,332

    Re: syntex error in date

    There isn't any code there to copy any data anywhere, so I'm not particularly surprised by that. You also haven't changed the date format as I suggested.

  10. #10
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: syntex error in date

    Hi guys

    I am writing this code but its not working. Scandate has number data type.
    Please Login or Register  to view this content.

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: syntex error in date

    j should be outside the quotes.

  12. #12
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: syntex error in date

    Norie, its giving me runtime error 6 Overflow at following
    Please Login or Register  to view this content.

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: syntex error in date

    You don't need Val, actually you don't need j.
    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: syntex error in date

    Thanks Norie and romperstomper I changed the data type of J from Integer to long and it started working.

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. code generating compile error: syntex error
    By sankarsasmal in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-10-2013, 05:29 AM
  2. Syntex Error with IF, AND, OR statement
    By siamadu in forum Excel General
    Replies: 8
    Last Post: 06-09-2010, 04:30 PM
  3. Syntex error in select statement
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-17-2009, 05:38 AM
  4. Syntex Error ??
    By Paul Cooke in forum Excel General
    Replies: 4
    Last Post: 12-09-2005, 09:54 AM
  5. Please help to correct syntex error
    By james in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-09-2005, 12:06 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1