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!

Report based on Checkbox value

Status
Not open for further replies.

ashows

MIS
May 10, 2002
25
US
I have an Access 2003 database with a table and a form containing contact information and 20 Yes/No fields. The names are tblMaster and frmMaster. The check boxes represent up to 20 different groups that the contacts can be a member of. I've created another form (frmSelectGroup) which allows the user to select one of the 20 groups from a combo box.

Is there a way to take the group name selected in the combo box on frmSelectGroup and use VBA to generate a report that lists the contacts who are a member of the selected group?

Thanks in advance.
 
Sure VBA will do it

The name in the combo will be like so

MyGroup = YourComboBoxName.Column(x) 'where x is any column from 1 to as many as you have

Say its the first one then it would be Combo12.Column(1)

The power of this is you can assign any column to a variable


DougP, MCP
 
Since each contact could be a member of more than one group (i.e., more than one Yes/No box could be checked), I used the following code in the OnClick event of a button on the frmSelectGroup. Make sure the options in the drop-down list of the combo box on frmSelectGroup are spelled *exactly* the same as the field names in the table.

---------------------------------

stDocName = "rptContactGroups"

strField = [Forms]![frmSelectGroup]![cboSelectGroup]

'Set search criteria to select all records where the selected field name box is checked.
stLinkCriteria = "
Code:
[
" & strField & "
Code:
]
= -1"

DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria, acWindowNormal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top