简体   繁体   中英

Adding Records from a pop-up query to a subform within the main form using VBA, Access 2010

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM