Reputation: 211
I have a form with a list of records with location information. Each record starts with a checkbox. I would like the user to be able to select multiple records they are interested in by clicking the checkboxes and then click a submit button on the bottom to then pass the selections through and copy them as new records to another form. How would I do this in VBA?
First, the data for my main form is fed in through a table. I created a new field and assigned it as a Boolean data type to show a checkbox icon next to each record in the form. Everything is checked on by default which is the first issue. How do I get all records to be unchecked by default?
Second, assuming I figure out the checkbox issue, how do I then have Access pull the desired records into a new form via a coded submit button?
Upvotes: 0
Views: 1045
Reputation: 151
If you include the checkbox as a boolean table field, you can update the records and then when the user clicks the command button, either pass the SQL clause "where fieldY =true" as a parameter like "DoCmd.OpenForm "SecondForm", acNormal, , , , , "where fieldY =true". Then in the form open event, use Me.OpenArgs to get the clause to filter the records.
Or just have the second form record source include the clause "where fieldY =true" so it always opens with just those records.
Upvotes: 1