Title: Adding Records from a pop-up query to a subform within the main form using VBA, Access 2010
Tags: ms-access;vba;ms-access-2010
Question: I have a main ```Purchase_Orders``` Form with an ```Items``` subform. I have also created a button that opens a popup form and queries previous Purchase orders for ```items``` that have been purchased from the same ```supplier``` which has been selected on the main form. I have added an unbound checkbox to this popup query.

Now what I want to be able to do, is have an "assign" button that will select each record in the query where the checkbox = true (or 1 I'm not sure). And then input those records in to the main subform, ```Items```. 

Is this possible? and any ideas how I may go about coding this in VBA? I am pretty new to VBA but if I get anywhere with the code, I will edit this post with further info. Thanks!



Here is another answer: If you want to add multiple items at once then you will need to use some form of unbound control, and a VBA loop to insert.

The simplest way would be to load a multi-select enabled ListBox and use that to allow the user to choose items. Then upon clicking the ```Assign``` button, you can loop through the listbox and insert the items into the table.

If you want more specific help you're going to need to provide much more specific data. Table structures, form fields/data sources, form names, perhaps some VBA behind the forms.


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:08/10/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<ms-access><vba><ms-access-2010>', 'Title': 'Adding Records from a pop-up query to a subform within the main form using VBA, Access 2010', 'ViewCount': 350, 'id': 31922725, 'user_AboutMe': '<p>Masters in Chemistry.</p>\n\n<p>Ms-Access and VBA programming user.</p>\n', 'user_AccountId': 6518438.0, 'user_DisplayName': 'LiamH', 'user_Reputation': 1482.0, 'user_Views': 115.0, 'user_id': 5043393.0}}