CREATE a report based on a selection on a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top