How do I record multiple options in Microsoft Access
October 7, 2008 5:49 PM
Subscribe
I can't believe I don't know how to select many checkboxes in Microsoft Access...
OK, say you have a store where you sell sporting equipment. You are trying to figure out some new things to carry so you are surveying your customers and you are then entering the data into an Access database.
You have three categories of items you are thinking about selling; volleyball equipment, equestrian equipment, and hiking equipment. Each category has several items in it such as freeze-dried meals, backpacks, tents, etc. The paper form has customers fill out information about themselves and then check the box of anything they would be interested in seeing at the store.
In your database you have a table for the customer info. You also have a table where you assign each type of equipment a number and a table that associates customers and their equipment choices.
Here is the problem. How in the heck do I make an entry form that will allow me to enter customer info AND check multiple boxes of equipment types and then have it all go to the places it's supposed to? I know how to make a drop down list but they aren't choosing between these things, they could choose them all if they wanted.
I have fallen into this conundrum when I wanted to make a database where each item could be searched by several keywords. How in the hell do you do several keywords? I feel like I should know this but I don't. Yes, I am a total chote and the answer is probably right before my eyes. I have done some searching online but I don't seem to know the correct terminology to bring up relevant information.
posted by Foam Pants to computers & internet (9 comments total)
Are the equipment choices offered to the respondent being stored as additional fields in your 'customer' table, or as a third table that links to (a) the customer record; and (b) each piece of equipment selected? The first option would be terrible from a design standpoint, but would make designing your form easier (and render your 'equipment' table probably superfluous). The second option is better form, but harder to code behind. What you'll probably need to do is attach a trigger to the form's save event that does some VBA jigglepokery and manually parses the state of the checkboxes and update the database accordingly. If this is in fact what you'll need to do, I'm sure someone here can provide in broad strokes the code that will get you on your way.
Regarding the keyword question, what you're probably going to want to do is put a text box on your form ('enter search terms here'), with a "Search" button. When the button is clicked, you'll write a bit of VBA to parse the contents of the textbox and do the search like
Percent signs represent a wildcard search here, and 'foo' and 'bar' are VBA variables holding the results of having split the textbox value into separate variables.
posted by Doofus Magoo at 6:01 PM on October 7, 2008