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;
I'm trying to figure out how to get the value from a textbox in my form (shown below) to use in a query. 
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
add a comment |
I'm trying to figure out how to get the value from a textbox in my form (shown below) to use in a query. 
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
2
Highlighted item is not same as referenced in the example INSERT. Is PMRT_Training_ID an autonumber field? Do you want to save5as 'something'? Is this a BOUND form? Why do you need INSERT action?
– June7
Mar 26 at 19:37
add a comment |
I'm trying to figure out how to get the value from a textbox in my form (shown below) to use in a query. 
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
I'm trying to figure out how to get the value from a textbox in my form (shown below) to use in a query. 
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
sql vba forms ms-access textbox
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 save5as 'something'? Is this a BOUND form? Why do you need INSERT action?
– June7
Mar 26 at 19:37
add a comment |
2
Highlighted item is not same as referenced in the example INSERT. Is PMRT_Training_ID an autonumber field? Do you want to save5as '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
add a comment |
2 Answers
2
active
oldest
votes
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.
add a comment |
A dynamic parameterized query object pulls value from form like:
INSERT INTO Table1 (field1, field2, field3) VALUES (25, Forms!formname.PMRT_Training_ID, 'something');
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
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
add a comment |
add a comment |
A dynamic parameterized query object pulls value from form like:
INSERT INTO Table1 (field1, field2, field3) VALUES (25, Forms!formname.PMRT_Training_ID, 'something');
add a comment |
A dynamic parameterized query object pulls value from form like:
INSERT INTO Table1 (field1, field2, field3) VALUES (25, Forms!formname.PMRT_Training_ID, 'something');
add a comment |
A dynamic parameterized query object pulls value from form like:
INSERT INTO Table1 (field1, field2, field3) VALUES (25, Forms!formname.PMRT_Training_ID, 'something');
A dynamic parameterized query object pulls value from form like:
INSERT INTO Table1 (field1, field2, field3) VALUES (25, Forms!formname.PMRT_Training_ID, 'something');
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
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
2
Highlighted item is not same as referenced in the example INSERT. Is PMRT_Training_ID an autonumber field? Do you want to save
5as 'something'? Is this a BOUND form? Why do you need INSERT action?– June7
Mar 26 at 19:37