Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Selection Field

Status
Not open for further replies.

ZPBJ

Technical User
Jan 20, 2005
37
US
Is there are pretty way to allow users to select more than one answer/option in an Access Form? Min 1 Max 15

Thanks, Bryan

__________________________________
Remember that time when I took the box? - Peter Griffin
 
Bryan,

If you can create a variable or variables that hold the selections, there are plenty of choices for this.

Listboxes have a multiselect property. You could use checkboxes or radio buttons for a traditional look.

I've used command buttons and changed the forecolor to indicate that it has been selected:
Code:
Private Sub Command49_Click()
Dim myVariable As String

If Command49.ForeColor = vbBlack Then
Command49.ForeColor = vbRed  [COLOR=green]'it has been selected[/color]
myVariable = myVariable & ", " & Command49.Caption
Else
Command49.ForeColor = vbBlack  [COLOR=green]'it has been de-selected[/color]
myVariable = Replace(myVariable, ", " & Command49.Caption, "")
End If
MsgBox Mid(myVariable, 3)

End Sub

HTH


"I could have fired him because he cut the board 2' 5" long when I asked for 25 inches.
I could have fired him because he threw that board aside to find another one when it only needed 4" cut off of it.
I had to fire him because when he threw the board, I heard him say, 'Stupid wood!'" -The Foreman
 
Any suggestions to record the selections in one field? They are indexed numerically.

__________________________________
Remember that time when I took the box? - Peter Griffin
 
Combining different values in one field is usually something to do with a query for reporting purposes. At the data-capture stage, I think you'd be better off storing the data in a normalized structure.

Check out
"I could have fired him because he cut the board 2' 5" long when I asked for 25 inches.
I could have fired him because he threw that board aside to find another one when it only needed 4" cut off of it.
I had to fire him because when he threw the board, I heard him say, 'Stupid wood!'" -The Foreman
 
If not in one field, and I create fields to capture DetailID2, 3, 4 through to 15, how do I ensure it populates?

When this project was started it was understood the field would track the primary reason, but we are being directed to make it more flexible.

__________________________________
Remember that time when I took the box? - Peter Griffin
 
Could you explain a bit more about the project? Is there one question that has 1 to many answers posible, or are there multiple questions and multiple questions?

My first thought would be a table that has three fields:
ResponderID, SelectionID, IsPrimary

Data would look like:
Code:
[b]ResponderID     SelectionID     IsPrimary[/b]
JohnDoeSSN               2               No
JohnDoeSSN               13              Yes
JohnDoeSSN               4               No
JohnDoeSSN               7               No
JaneDoeSSN               13              No
JaneDoeSSN               9               Yes 
JaneDoeSSN               3               No

This data lets you answer the following questions pretty quickly and easily with Dcounts or Totals queries:

How many people responded?
How many times was any given detail selected as the primary selection?
How many times was any given detail selected as a non-primary detail?
How many times was any given detail selected as non-primary when a specific detail was selected as primary?
What detail was selected the most as Primary, non-primary, either?
What detail was selected the least?
What detail was selected the most as non-primary while being selected the least as primary?
And so on...


If you create a separate field for each DetailID or possible answer, you would have to re-manipulate the data into a normal structure to get to most of this information.




"I could have fired him because he cut the board 2' 5" long when I asked for 25 inches.
I could have fired him because he threw that board aside to find another one when it only needed 4" cut off of it.
I had to fire him because when he threw the board, I heard him say, 'Stupid wood!'" -The Foreman
 
The table is capturing the following info from the form

AcctID
ErrorType
ErrorDetailID (this is the one that should accept multiple IDs)
ProcessorID
System
FunctionID
SID (auto cap)
Date (auto cap)

__________________________________
Remember that time when I took the box? - Peter Griffin
 
The first post I put up included the code for building the string of selected DetailIDs if that is what you want in the ErrorDetailId field. Set the control that is bound to that field <text01> to update after each click event on the command buttons, or check boxes:

Code:
text01 = myVariable
text01.requery

If you want it more useful as far as accessing the data as I spoke before, use an append query on the click event of your control to add each selected ErrorDetailID as a record. You would have to include some logic to see if someone is clicking to select the option or deselect the option and run an append or delete query as appropriate.

You mentioned "primary reason" in an earlier post. Is that something that still needs to be accounted for? I don't see it in your table layout.


HTH





"I could have fired him because he cut the board 2' 5" long when I asked for 25 inches.
I could have fired him because he threw that board aside to find another one when it only needed 4" cut off of it.
I had to fire him because when he threw the board, I heard him say, 'Stupid wood!'" -The Foreman
 
Bryan,
I had a similar problem to yours (I think!) and I found the following link very useful:
thread702-670645

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top