Access: Query from Value in FormInsert into … values ( SELECT … FROM … )Add a column with a default value to an existing table in SQL ServerSQLite - UPSERT *not* INSERT or REPLACEInserting multiple rows in a single SQL query?How do I UPDATE from a SELECT in SQL Server?Finding duplicate values in a SQL tableHow to query MongoDB with “like”?SQL query return data from multiple tablesMs Access query- FROM [Forms]![formname]!textbox value?Error related to only_full_group_by when executing a query in MySql

Leaf-Spine network without routing

How do I explain an exponentially complex intuitively?

Did the IBM PC use the 8088's NMI line?

Why isn't there any 9.5 digit multimeter or higher?

Commercial jet accompanied by small plane near Seattle

Request for a Latin phrase as motto "God is highest/supreme"

Can the term divorcée apply if a woman has not only divorced, but subsequently remarried?

Isolated audio without a transformer

Decreasing star size

Word for showing a small part of something briefly to hint to its existence or beauty without fully uncovering it

Why is 'n' preferred over "n" for output streams?

Send a single HTML email from Thunderbird, overriding the default "plain text" setting

Use cases for M-0 & C-0?

How to check what is edible on an alien world?

Why/when is AC-DC-AC conversion superior to direct AC-Ac conversion?

What do I do with a party that is much stronger than their level?

Checking if an integer is a member of an integer list

Is there a wealth gap in Boston where the median net worth of white households is $247,500 while the median net worth for black families was $8?

How to judge a Ph.D. applicant that arrives "out of thin air"

Does the Intel 8086 CPU have user mode and kernel mode?

Is it possible to pass "draft" option to documentclass with arara?

Are the named pipe created by `mknod` and the FIFO created by `mkfifo` equivalent?

How do I stop my characters falling in love?

Writing a clean implementation of Rock, Paper, Scissors game in c++



Access: Query from Value in Form


Insert into … values ( SELECT … FROM … )Add a column with a default value to an existing table in SQL ServerSQLite - UPSERT *not* INSERT or REPLACEInserting multiple rows in a single SQL query?How do I UPDATE from a SELECT in SQL Server?Finding duplicate values in a SQL tableHow to query MongoDB with “like”?SQL query return data from multiple tablesMs Access query- FROM [Forms]![formname]!textbox value?Error related to only_full_group_by when executing a query in MySql






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








1















I'm trying to figure out how to get the value from a textbox in my form (shown below) to use in a query. enter image description here



So for example, how would I get the highlighted "5" to use in a query to insert it into a table, and make sure the query knows which form and which textbox to get the information from?



Then figuring out how to have the query know to look in this form and the right textbox is the part giving me trouble.



I thought it would be something like



INSERT INTO Table1 VALUES (25, PMRT_Training_ID.value, 'something');



but that just pops up a box asking for another value.










share|improve this question



















  • 2





    Highlighted item is not same as referenced in the example INSERT. Is PMRT_Training_ID an autonumber field? Do you want to save 5 as 'something'? Is this a BOUND form? Why do you need INSERT action?

    – June7
    Mar 26 at 19:37


















1















I'm trying to figure out how to get the value from a textbox in my form (shown below) to use in a query. enter image description here



So for example, how would I get the highlighted "5" to use in a query to insert it into a table, and make sure the query knows which form and which textbox to get the information from?



Then figuring out how to have the query know to look in this form and the right textbox is the part giving me trouble.



I thought it would be something like



INSERT INTO Table1 VALUES (25, PMRT_Training_ID.value, 'something');



but that just pops up a box asking for another value.










share|improve this question



















  • 2





    Highlighted item is not same as referenced in the example INSERT. Is PMRT_Training_ID an autonumber field? Do you want to save 5 as 'something'? Is this a BOUND form? Why do you need INSERT action?

    – June7
    Mar 26 at 19:37














1












1








1








I'm trying to figure out how to get the value from a textbox in my form (shown below) to use in a query. enter image description here



So for example, how would I get the highlighted "5" to use in a query to insert it into a table, and make sure the query knows which form and which textbox to get the information from?



Then figuring out how to have the query know to look in this form and the right textbox is the part giving me trouble.



I thought it would be something like



INSERT INTO Table1 VALUES (25, PMRT_Training_ID.value, 'something');



but that just pops up a box asking for another value.










share|improve this question
















I'm trying to figure out how to get the value from a textbox in my form (shown below) to use in a query. enter image description here



So for example, how would I get the highlighted "5" to use in a query to insert it into a table, and make sure the query knows which form and which textbox to get the information from?



Then figuring out how to have the query know to look in this form and the right textbox is the part giving me trouble.



I thought it would be something like



INSERT INTO Table1 VALUES (25, PMRT_Training_ID.value, 'something');



but that just pops up a box asking for another value.







sql vba forms ms-access textbox






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 19:13









June7

6,3945 gold badges13 silver badges28 bronze badges




6,3945 gold badges13 silver badges28 bronze badges










asked Mar 26 at 18:51









BobBob

5982 gold badges8 silver badges28 bronze badges




5982 gold badges8 silver badges28 bronze badges







  • 2





    Highlighted item is not same as referenced in the example INSERT. Is PMRT_Training_ID an autonumber field? Do you want to save 5 as 'something'? Is this a BOUND form? Why do you need INSERT action?

    – June7
    Mar 26 at 19:37













  • 2





    Highlighted item is not same as referenced in the example INSERT. Is PMRT_Training_ID an autonumber field? Do you want to save 5 as 'something'? Is this a BOUND form? Why do you need INSERT action?

    – June7
    Mar 26 at 19:37








2




2





Highlighted item is not same as referenced in the example INSERT. Is PMRT_Training_ID an autonumber field? Do you want to save 5 as 'something'? Is this a BOUND form? Why do you need INSERT action?

– June7
Mar 26 at 19:37






Highlighted item is not same as referenced in the example INSERT. Is PMRT_Training_ID an autonumber field? Do you want to save 5 as 'something'? Is this a BOUND form? Why do you need INSERT action?

– June7
Mar 26 at 19:37













2 Answers
2






active

oldest

votes


















1














Assuming that your form remains open when the action query is executed, then the general syntax for referencing a value held by a control on a form is:



Forms!YourFormName!YourControlName


In the case of a subform, consider that the subform is just another control on the parent form, and so the chain of references becomes:



Forms!YourFormName!SubFormName.Form!SubFormControlName


You can test the value obtained by simply creating a new query in Access with the SQL code:



select Forms!YourFormName!YourControlName as FormValue


When run, this will yield a single record displaying whichever value was held by the control YourControlName on the open form YourFormName at the time of execution.






share|improve this answer
































    1














    A dynamic parameterized query object pulls value from form like:



    INSERT INTO Table1 (field1, field2, field3) VALUES (25, Forms!formname.PMRT_Training_ID, 'something');






    share|improve this answer



























      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%2f55364364%2faccess-query-from-value-in-form%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      Assuming that your form remains open when the action query is executed, then the general syntax for referencing a value held by a control on a form is:



      Forms!YourFormName!YourControlName


      In the case of a subform, consider that the subform is just another control on the parent form, and so the chain of references becomes:



      Forms!YourFormName!SubFormName.Form!SubFormControlName


      You can test the value obtained by simply creating a new query in Access with the SQL code:



      select Forms!YourFormName!YourControlName as FormValue


      When run, this will yield a single record displaying whichever value was held by the control YourControlName on the open form YourFormName at the time of execution.






      share|improve this answer





























        1














        Assuming that your form remains open when the action query is executed, then the general syntax for referencing a value held by a control on a form is:



        Forms!YourFormName!YourControlName


        In the case of a subform, consider that the subform is just another control on the parent form, and so the chain of references becomes:



        Forms!YourFormName!SubFormName.Form!SubFormControlName


        You can test the value obtained by simply creating a new query in Access with the SQL code:



        select Forms!YourFormName!YourControlName as FormValue


        When run, this will yield a single record displaying whichever value was held by the control YourControlName on the open form YourFormName at the time of execution.






        share|improve this answer



























          1












          1








          1







          Assuming that your form remains open when the action query is executed, then the general syntax for referencing a value held by a control on a form is:



          Forms!YourFormName!YourControlName


          In the case of a subform, consider that the subform is just another control on the parent form, and so the chain of references becomes:



          Forms!YourFormName!SubFormName.Form!SubFormControlName


          You can test the value obtained by simply creating a new query in Access with the SQL code:



          select Forms!YourFormName!YourControlName as FormValue


          When run, this will yield a single record displaying whichever value was held by the control YourControlName on the open form YourFormName at the time of execution.






          share|improve this answer















          Assuming that your form remains open when the action query is executed, then the general syntax for referencing a value held by a control on a form is:



          Forms!YourFormName!YourControlName


          In the case of a subform, consider that the subform is just another control on the parent form, and so the chain of references becomes:



          Forms!YourFormName!SubFormName.Form!SubFormControlName


          You can test the value obtained by simply creating a new query in Access with the SQL code:



          select Forms!YourFormName!YourControlName as FormValue


          When run, this will yield a single record displaying whichever value was held by the control YourControlName on the open form YourFormName at the time of execution.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 27 at 17:31









          June7

          6,3945 gold badges13 silver badges28 bronze badges




          6,3945 gold badges13 silver badges28 bronze badges










          answered Mar 26 at 23:36









          Lee MacLee Mac

          8,3526 gold badges17 silver badges49 bronze badges




          8,3526 gold badges17 silver badges49 bronze badges























              1














              A dynamic parameterized query object pulls value from form like:



              INSERT INTO Table1 (field1, field2, field3) VALUES (25, Forms!formname.PMRT_Training_ID, 'something');






              share|improve this answer





























                1














                A dynamic parameterized query object pulls value from form like:



                INSERT INTO Table1 (field1, field2, field3) VALUES (25, Forms!formname.PMRT_Training_ID, 'something');






                share|improve this answer



























                  1












                  1








                  1







                  A dynamic parameterized query object pulls value from form like:



                  INSERT INTO Table1 (field1, field2, field3) VALUES (25, Forms!formname.PMRT_Training_ID, 'something');






                  share|improve this answer















                  A dynamic parameterized query object pulls value from form like:



                  INSERT INTO Table1 (field1, field2, field3) VALUES (25, Forms!formname.PMRT_Training_ID, 'something');







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 27 at 17:33

























                  answered Mar 26 at 19:30









                  June7June7

                  6,3945 gold badges13 silver badges28 bronze badges




                  6,3945 gold badges13 silver badges28 bronze badges



























                      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%2f55364364%2faccess-query-from-value-in-form%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

                      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

                      용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                      155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해