CREATE a report based on a selection on a form

G

Gntlhnds

I would like to create a report based on a selection from a combo box on a
form. Basically, I want a user to select a value from a combo box that
corresponds to a value in a field in my main table of contacts, and the
report that is generated just shows those contacts that have that specific
value in that field (I hope that makes sense). Because there are 16
different values that can be in that field, I don't want to create 16
different reports that the combo box and choose from, I just want the combo
box to create the report.
 
C

Carl Rapson

Gntlhnds said:
I would like to create a report based on a selection from a combo box on a
form. Basically, I want a user to select a value from a combo box that
corresponds to a value in a field in my main table of contacts, and the
report that is generated just shows those contacts that have that specific
value in that field (I hope that makes sense). Because there are 16
different values that can be in that field, I don't want to create 16
different reports that the combo box and choose from, I just want the
combo
box to create the report.

Create a report based on the table, then open the report from your form like
this:

DoCmd.OpenReport "reportname",,,"[FieldName]=" & cboValue

You didn't give any names in your post, so I made up names for the report,
field, and combo box. Be sure to use your own names in those positions. If
the combo box value is text instead of numeric, you'll need to add quotes
around the value:

DoCmd.OpenReport "reportname",,,"[FieldName]='" & cboValue & "'"

Carl Rapson
 
Top