Access 2013 VBA Editor Changes Date() to dateMSAccess - File-Open Dialog w/Many Versions of AccessAccess 2013 and other Office products to work in Office 2003Access 2013 accde file can't export to acFormatXLSXConnecting Excel 2013 to MS AccessAccess VBA: Recordset should be NOT nothingMS Access Form button that allows user to browse/choose file excel , then imports file to a tableTrying to run a DELETE query using DAO in VBAINSERT INTO query in VBAAccess to Excel export Error 2302 can't save the output data to the file you've selectedVBA Access User-Defined Type not Defined when Running my AutoExec Macro

Who are these Discworld wizards from this picture?

Is there a nice way to assign std::minmax(a, b) to std::tie(a, b)?

How can I get edges to bend to avoid crossing?

How to fix a dry solder pin in BGA package?

Can Access Fault Exceptions of the MC68040 caused by internal access faults occur in normal situations?

What could a reptilian race tell by candling their eggs?

Why do I need two parameters in an HTTP parameter pollution attack?

Was it really unprofessional of me to leave without asking for a raise first?

Does anyone know what these symbols mean?

Can you sign using a digital signature itself?

How exactly is a normal force exerted, at the molecular level?

Can a single server be associated with multiple domains?

Does the Pi 4 resolve the Ethernet+USB bottleneck issue of past versions?

Golf the smallest circle!

What is the highest number of sneak attacks that a Pure/High Level Rogue (Level 17+) can make in one round?

Is there reliable evidence that depleted uranium from the 1999 NATO bombing is causing cancer in Serbia?

What does Mildred mean by this line in Three Billboards Outside Ebbing, Missouri?

Spicket or spigot?

What is "oversubscription" in Networking?

Should I share with a new service provider a bill from its competitor?

Can a Federation colony become a member world?

One folder two different locations on ubuntu 18.04

How can my story take place on Earth without referring to our existing cities and countries?

Inquiring about the possibility of a job



Access 2013 VBA Editor Changes Date() to date


MSAccess - File-Open Dialog w/Many Versions of AccessAccess 2013 and other Office products to work in Office 2003Access 2013 accde file can't export to acFormatXLSXConnecting Excel 2013 to MS AccessAccess VBA: Recordset should be NOT nothingMS Access Form button that allows user to browse/choose file excel , then imports file to a tableTrying to run a DELETE query using DAO in VBAINSERT INTO query in VBAAccess to Excel export Error 2302 can't save the output data to the file you've selectedVBA Access User-Defined Type not Defined when Running my AutoExec Macro






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















When I type strDate = Date() it switches to strDate = date, and then the code does not run correctly because it does not know what "date" refers to. This is in a brand new Access 2013 database with only a single form with a button to run the code and a table with only one field to insert the date.



References that are checked for this database are:



  • Visual Basic For Applications

  • Microsoft Access 15.0 Object Library

  • OLE Automation


  • Microsoft Office 15.0 Access database engine Object Library



    Dim strDate As String
    strDate = Date()

    DoCmd.SetWarnings False

    Dim strSQL As String
    strSQL = "INSERT INTO Table1 VALUES ('" & strDate & "');"
    DoCmd.RunSQL strSQL

    DoCmd.SetWarnings True










share|improve this question






























    1















    When I type strDate = Date() it switches to strDate = date, and then the code does not run correctly because it does not know what "date" refers to. This is in a brand new Access 2013 database with only a single form with a button to run the code and a table with only one field to insert the date.



    References that are checked for this database are:



    • Visual Basic For Applications

    • Microsoft Access 15.0 Object Library

    • OLE Automation


    • Microsoft Office 15.0 Access database engine Object Library



      Dim strDate As String
      strDate = Date()

      DoCmd.SetWarnings False

      Dim strSQL As String
      strSQL = "INSERT INTO Table1 VALUES ('" & strDate & "');"
      DoCmd.RunSQL strSQL

      DoCmd.SetWarnings True










    share|improve this question


























      1












      1








      1








      When I type strDate = Date() it switches to strDate = date, and then the code does not run correctly because it does not know what "date" refers to. This is in a brand new Access 2013 database with only a single form with a button to run the code and a table with only one field to insert the date.



      References that are checked for this database are:



      • Visual Basic For Applications

      • Microsoft Access 15.0 Object Library

      • OLE Automation


      • Microsoft Office 15.0 Access database engine Object Library



        Dim strDate As String
        strDate = Date()

        DoCmd.SetWarnings False

        Dim strSQL As String
        strSQL = "INSERT INTO Table1 VALUES ('" & strDate & "');"
        DoCmd.RunSQL strSQL

        DoCmd.SetWarnings True










      share|improve this question
















      When I type strDate = Date() it switches to strDate = date, and then the code does not run correctly because it does not know what "date" refers to. This is in a brand new Access 2013 database with only a single form with a button to run the code and a table with only one field to insert the date.



      References that are checked for this database are:



      • Visual Basic For Applications

      • Microsoft Access 15.0 Object Library

      • OLE Automation


      • Microsoft Office 15.0 Access database engine Object Library



        Dim strDate As String
        strDate = Date()

        DoCmd.SetWarnings False

        Dim strSQL As String
        strSQL = "INSERT INTO Table1 VALUES ('" & strDate & "');"
        DoCmd.RunSQL strSQL

        DoCmd.SetWarnings True







      ms-access access-vba






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 25 at 12:51









      Lee Mac

      7,3065 gold badges17 silver badges47 bronze badges




      7,3065 gold badges17 silver badges47 bronze badges










      asked Mar 25 at 12:35









      sruhs007sruhs007

      62 bronze badges




      62 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Since you are inserting a date value into your table, the value should not be enclosed with single quotes, else the data will be interpreted as a string.



          Similarly, the Date function will return a date value, hence your variable strDate should be of type Date as opposed to String.



          The automatic conversion of Date() to Date is to be expected and will still result in the Date function being evaluated with no arguments; I believe this conversion occurs because the symbol Date also corresponds to a data type.



          However, an easier way to achieve this is to simply evaluate the Date function directly in the SQL code, for example:



          DoCmd.RunSQL "INSERT INTO Table1 VALUES (Date());"





          share|improve this answer

























          • Thank you. This database was a simplified experiment/test. My company uses a database that runs a backup when it is run for the first time on a given day. It is a bi-coastal company, and our folks on the West coast have been upgraded from Windows 7 to Windows 10, and they get errors on start up: "Function is not available in expressions in query expression 'BackupDate = date('." There was another error that also referenced the date function. Here on the East coast we are still on Windows 7 for now. I created the above to test the date function in Windows 10. Still inconclusive.

            – sruhs007
            Mar 25 at 14:53











          • @sruhs007 That info must be added to question, as it leads us to a broken reference. Check on Win10 if some are markedmissing! Office versions are the same?

            – ComputerVersteher
            Mar 27 at 0:04











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55337925%2faccess-2013-vba-editor-changes-date-to-date%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Since you are inserting a date value into your table, the value should not be enclosed with single quotes, else the data will be interpreted as a string.



          Similarly, the Date function will return a date value, hence your variable strDate should be of type Date as opposed to String.



          The automatic conversion of Date() to Date is to be expected and will still result in the Date function being evaluated with no arguments; I believe this conversion occurs because the symbol Date also corresponds to a data type.



          However, an easier way to achieve this is to simply evaluate the Date function directly in the SQL code, for example:



          DoCmd.RunSQL "INSERT INTO Table1 VALUES (Date());"





          share|improve this answer

























          • Thank you. This database was a simplified experiment/test. My company uses a database that runs a backup when it is run for the first time on a given day. It is a bi-coastal company, and our folks on the West coast have been upgraded from Windows 7 to Windows 10, and they get errors on start up: "Function is not available in expressions in query expression 'BackupDate = date('." There was another error that also referenced the date function. Here on the East coast we are still on Windows 7 for now. I created the above to test the date function in Windows 10. Still inconclusive.

            – sruhs007
            Mar 25 at 14:53











          • @sruhs007 That info must be added to question, as it leads us to a broken reference. Check on Win10 if some are markedmissing! Office versions are the same?

            – ComputerVersteher
            Mar 27 at 0:04
















          0














          Since you are inserting a date value into your table, the value should not be enclosed with single quotes, else the data will be interpreted as a string.



          Similarly, the Date function will return a date value, hence your variable strDate should be of type Date as opposed to String.



          The automatic conversion of Date() to Date is to be expected and will still result in the Date function being evaluated with no arguments; I believe this conversion occurs because the symbol Date also corresponds to a data type.



          However, an easier way to achieve this is to simply evaluate the Date function directly in the SQL code, for example:



          DoCmd.RunSQL "INSERT INTO Table1 VALUES (Date());"





          share|improve this answer

























          • Thank you. This database was a simplified experiment/test. My company uses a database that runs a backup when it is run for the first time on a given day. It is a bi-coastal company, and our folks on the West coast have been upgraded from Windows 7 to Windows 10, and they get errors on start up: "Function is not available in expressions in query expression 'BackupDate = date('." There was another error that also referenced the date function. Here on the East coast we are still on Windows 7 for now. I created the above to test the date function in Windows 10. Still inconclusive.

            – sruhs007
            Mar 25 at 14:53











          • @sruhs007 That info must be added to question, as it leads us to a broken reference. Check on Win10 if some are markedmissing! Office versions are the same?

            – ComputerVersteher
            Mar 27 at 0:04














          0












          0








          0







          Since you are inserting a date value into your table, the value should not be enclosed with single quotes, else the data will be interpreted as a string.



          Similarly, the Date function will return a date value, hence your variable strDate should be of type Date as opposed to String.



          The automatic conversion of Date() to Date is to be expected and will still result in the Date function being evaluated with no arguments; I believe this conversion occurs because the symbol Date also corresponds to a data type.



          However, an easier way to achieve this is to simply evaluate the Date function directly in the SQL code, for example:



          DoCmd.RunSQL "INSERT INTO Table1 VALUES (Date());"





          share|improve this answer















          Since you are inserting a date value into your table, the value should not be enclosed with single quotes, else the data will be interpreted as a string.



          Similarly, the Date function will return a date value, hence your variable strDate should be of type Date as opposed to String.



          The automatic conversion of Date() to Date is to be expected and will still result in the Date function being evaluated with no arguments; I believe this conversion occurs because the symbol Date also corresponds to a data type.



          However, an easier way to achieve this is to simply evaluate the Date function directly in the SQL code, for example:



          DoCmd.RunSQL "INSERT INTO Table1 VALUES (Date());"






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 25 at 13:11

























          answered Mar 25 at 12:54









          Lee MacLee Mac

          7,3065 gold badges17 silver badges47 bronze badges




          7,3065 gold badges17 silver badges47 bronze badges












          • Thank you. This database was a simplified experiment/test. My company uses a database that runs a backup when it is run for the first time on a given day. It is a bi-coastal company, and our folks on the West coast have been upgraded from Windows 7 to Windows 10, and they get errors on start up: "Function is not available in expressions in query expression 'BackupDate = date('." There was another error that also referenced the date function. Here on the East coast we are still on Windows 7 for now. I created the above to test the date function in Windows 10. Still inconclusive.

            – sruhs007
            Mar 25 at 14:53











          • @sruhs007 That info must be added to question, as it leads us to a broken reference. Check on Win10 if some are markedmissing! Office versions are the same?

            – ComputerVersteher
            Mar 27 at 0:04


















          • Thank you. This database was a simplified experiment/test. My company uses a database that runs a backup when it is run for the first time on a given day. It is a bi-coastal company, and our folks on the West coast have been upgraded from Windows 7 to Windows 10, and they get errors on start up: "Function is not available in expressions in query expression 'BackupDate = date('." There was another error that also referenced the date function. Here on the East coast we are still on Windows 7 for now. I created the above to test the date function in Windows 10. Still inconclusive.

            – sruhs007
            Mar 25 at 14:53











          • @sruhs007 That info must be added to question, as it leads us to a broken reference. Check on Win10 if some are markedmissing! Office versions are the same?

            – ComputerVersteher
            Mar 27 at 0:04

















          Thank you. This database was a simplified experiment/test. My company uses a database that runs a backup when it is run for the first time on a given day. It is a bi-coastal company, and our folks on the West coast have been upgraded from Windows 7 to Windows 10, and they get errors on start up: "Function is not available in expressions in query expression 'BackupDate = date('." There was another error that also referenced the date function. Here on the East coast we are still on Windows 7 for now. I created the above to test the date function in Windows 10. Still inconclusive.

          – sruhs007
          Mar 25 at 14:53





          Thank you. This database was a simplified experiment/test. My company uses a database that runs a backup when it is run for the first time on a given day. It is a bi-coastal company, and our folks on the West coast have been upgraded from Windows 7 to Windows 10, and they get errors on start up: "Function is not available in expressions in query expression 'BackupDate = date('." There was another error that also referenced the date function. Here on the East coast we are still on Windows 7 for now. I created the above to test the date function in Windows 10. Still inconclusive.

          – sruhs007
          Mar 25 at 14:53













          @sruhs007 That info must be added to question, as it leads us to a broken reference. Check on Win10 if some are markedmissing! Office versions are the same?

          – ComputerVersteher
          Mar 27 at 0:04






          @sruhs007 That info must be added to question, as it leads us to a broken reference. Check on Win10 if some are markedmissing! Office versions are the same?

          – ComputerVersteher
          Mar 27 at 0:04









          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55337925%2faccess-2013-vba-editor-changes-date-to-date%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현