You could use the change event of the combobox to do this as soon as the user
selected an item. I wouldn't do this, but you can.
Why would I not do this?
==Because the user might type the value in, instead of selecting from the
list. That triggers a change on each character.
== the user might accidentally choose the wrong city and the report would run
before they could change to the correct city.
You could use the after Update event or the exit event.
Private Sub cboCity _Change()
If Not(IsNull(Me.cboCity)) THEN
DoCmd.OpenReport "ZipCodes",acViewNormal,,"[City]='" & Me.cboCity & "'"
End IF
End Sub
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
ADB_Seeker said:
Is it possible to have the combo box open the report based on the data
selected instead of adding a command button to open the report? It is an
extra step I would like to eliminate. Thank you in advance for your response.
Linda
KARL DEWEY said:
Remember that the form must remain open for the query to see the data.
--
Build a little, test a little.
:
Dog Chow wrote:
I have a databse Access 2003, my one column in a table has the title for a a
office department. I want to create a pop up form with a combo box that the
user can select which department they want the report to run on
Create an unbound form (not based on a table or query)
Add a combobox to the form. Set the RowSource to the table... choose the
field you want.
Create a button on your form to open the report
Private Sub OpenMyReport()
DoCmd.OpenReport "ZipCodes", acViewNormal, , "[City]='" & Me.cboCity &
"'"
End Sub
.