How to utilize a multiselect ListBox to add data to a table Unicorn Meta Zoo #1: Why another...
Bright yellow or light yellow?
Is Bran literally the world's memory?
Why does the Cisco show run command not show the full version, while the show version command does?
Was Objective-C really a hindrance to Apple software development?
Suing a Police Officer Instead of the Police Department
Why do people think Winterfell crypts is the safest place for women, children and old people?
TV series episode where humans nuke aliens before decrypting their message that states they come in peace
Where did Arya get these scars?
What is a good proxy for government quality?
Is it accepted to use working hours to read general interest books?
When does Bran Stark remember Jamie pushing him?
What is ls Largest Number Formed by only moving two sticks in 508?
What is /etc/mtab in Linux?
Where to find documentation for `whois` command options?
When I export an AI 300x60 art board it saves with bigger dimensions
France's Public Holidays' Puzzle
What happened to Viserion in Season 7?
How do I deal with an erroneously large refund?
What's called a person who works as someone who puts products on shelves in stores?
What is the definining line between a helicopter and a drone a person can ride in?
Why I cannot instantiate a class whose constructor is private in a friend class?
What's the difference between using dependency injection with a container and using a service locator?
"Working on a knee"
What were wait-states, and why was it only an issue for PCs?
How to utilize a multiselect ListBox to add data to a table
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar ManaraHow can I add a field to a MS Access 2002 form which relates to another table?MS Access 2010 Expression error when using Column filter - “The expression ”|“ you entered is invalid.”Inserting Autotext (or Quickpart) into Word (2013) on the basis of a Boolean value from Access (2013)Miscrosoft Access - Multi-Table Data EntryAccess - Link two records in same table / calculation of field from the recordsMS Access database with large amounts of text crashes often and loses dataHow to exclude pieces of a record in query countHow do you add a calculated column in an Access 2010 pivot tableAdd new linked table to SQLServer-Access databaseJoin Query on a “blank” Table - Need it to add when updating
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I have a form above. the short of my question is: I want to select a project # from dropdown, then select multiple companies from ListBox. And have them added to the table, i.e. project#, company#
. I have one table for projects and another for companies. I have set up a table for linked projects/companies to keep the records in. You can have multiple companies involved in 1 project.
Could someone please help with this?
My code is:
Private Sub UpdateSelected()
Dim xPR As String 'variable for project id to use same # for each data row insert
Dim xCR As String 'variable for company id to use selected # for each data row insert
Dim xselected As Boolean
xPR = PtblProjectIDComboBox.SelectedValue
xPR = Convert.ToInt32(xPR)
For i = 0 To ListBox1.Items.Count - 1 'count to stroll thru company db and check if selected
If ListBox1.GetSelected(i) = True Then 'if selected then add record project # and selected company#
xCR = Convert.ToInt32(ListBox1.ValueMember)
xselected = True
TableGroupProjectTableAdapter.Insert(xPR, xCR, xselected) 'add the record if it is valid
'update db
Validate()
TableAdapterManager.UpdateAll(CMDB1copy2DataSet)
End If
Next i
End Sub
Screenshot of the input form:
microsoft-access visual-studio-2017
New contributor
add a comment |
I have a form above. the short of my question is: I want to select a project # from dropdown, then select multiple companies from ListBox. And have them added to the table, i.e. project#, company#
. I have one table for projects and another for companies. I have set up a table for linked projects/companies to keep the records in. You can have multiple companies involved in 1 project.
Could someone please help with this?
My code is:
Private Sub UpdateSelected()
Dim xPR As String 'variable for project id to use same # for each data row insert
Dim xCR As String 'variable for company id to use selected # for each data row insert
Dim xselected As Boolean
xPR = PtblProjectIDComboBox.SelectedValue
xPR = Convert.ToInt32(xPR)
For i = 0 To ListBox1.Items.Count - 1 'count to stroll thru company db and check if selected
If ListBox1.GetSelected(i) = True Then 'if selected then add record project # and selected company#
xCR = Convert.ToInt32(ListBox1.ValueMember)
xselected = True
TableGroupProjectTableAdapter.Insert(xPR, xCR, xselected) 'add the record if it is valid
'update db
Validate()
TableAdapterManager.UpdateAll(CMDB1copy2DataSet)
End If
Next i
End Sub
Screenshot of the input form:
microsoft-access visual-studio-2017
New contributor
add a comment |
I have a form above. the short of my question is: I want to select a project # from dropdown, then select multiple companies from ListBox. And have them added to the table, i.e. project#, company#
. I have one table for projects and another for companies. I have set up a table for linked projects/companies to keep the records in. You can have multiple companies involved in 1 project.
Could someone please help with this?
My code is:
Private Sub UpdateSelected()
Dim xPR As String 'variable for project id to use same # for each data row insert
Dim xCR As String 'variable for company id to use selected # for each data row insert
Dim xselected As Boolean
xPR = PtblProjectIDComboBox.SelectedValue
xPR = Convert.ToInt32(xPR)
For i = 0 To ListBox1.Items.Count - 1 'count to stroll thru company db and check if selected
If ListBox1.GetSelected(i) = True Then 'if selected then add record project # and selected company#
xCR = Convert.ToInt32(ListBox1.ValueMember)
xselected = True
TableGroupProjectTableAdapter.Insert(xPR, xCR, xselected) 'add the record if it is valid
'update db
Validate()
TableAdapterManager.UpdateAll(CMDB1copy2DataSet)
End If
Next i
End Sub
Screenshot of the input form:
microsoft-access visual-studio-2017
New contributor
I have a form above. the short of my question is: I want to select a project # from dropdown, then select multiple companies from ListBox. And have them added to the table, i.e. project#, company#
. I have one table for projects and another for companies. I have set up a table for linked projects/companies to keep the records in. You can have multiple companies involved in 1 project.
Could someone please help with this?
My code is:
Private Sub UpdateSelected()
Dim xPR As String 'variable for project id to use same # for each data row insert
Dim xCR As String 'variable for company id to use selected # for each data row insert
Dim xselected As Boolean
xPR = PtblProjectIDComboBox.SelectedValue
xPR = Convert.ToInt32(xPR)
For i = 0 To ListBox1.Items.Count - 1 'count to stroll thru company db and check if selected
If ListBox1.GetSelected(i) = True Then 'if selected then add record project # and selected company#
xCR = Convert.ToInt32(ListBox1.ValueMember)
xselected = True
TableGroupProjectTableAdapter.Insert(xPR, xCR, xselected) 'add the record if it is valid
'update db
Validate()
TableAdapterManager.UpdateAll(CMDB1copy2DataSet)
End If
Next i
End Sub
Screenshot of the input form:
microsoft-access visual-studio-2017
microsoft-access visual-studio-2017
New contributor
New contributor
edited 11 hours ago
zx485
1,4672914
1,4672914
New contributor
asked 12 hours ago
James W. Brumbaugh Sr.James W. Brumbaugh Sr.
61
61
New contributor
New contributor
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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
});
}
});
James W. Brumbaugh Sr. is a new contributor. Be nice, and check out our Code of Conduct.
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%2fsuperuser.com%2fquestions%2f1428745%2fhow-to-utilize-a-multiselect-listbox-to-add-data-to-a-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
James W. Brumbaugh Sr. is a new contributor. Be nice, and check out our Code of Conduct.
James W. Brumbaugh Sr. is a new contributor. Be nice, and check out our Code of Conduct.
James W. Brumbaugh Sr. is a new contributor. Be nice, and check out our Code of Conduct.
James W. Brumbaugh Sr. is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Super User!
- 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%2fsuperuser.com%2fquestions%2f1428745%2fhow-to-utilize-a-multiselect-listbox-to-add-data-to-a-table%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