423,095 Members | 2,030 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,095 IT Pros & Developers. It's quick & easy.

combo box select when opening report

P: n/a
How can I get a combo box to come up when previewing a report so that
the user can select an event name and then print preview the report
specific to that event?

In the "On Open" event of the report I've tried
'Forms![Events2]![EventName]' and in the text box of the report I have
the "control source" as '=Forms!Events2!EventName.Value'. Using these
results in '#Error' being displayed in where the text box is.

Any help or direction would be appreciated.

Pasquale

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Pasquale, Just pass the argument to the open report procedure like so(replace the names with the
names of your controls)

Private Sub cmdMyButton_Click()
On Error GoTo Err_cmdMyButton_Click

Dim stDocName As String

stDocName = "rptYourReport"
DoCmd.OpenReport stDocName, acPreview, , "[EventName] = '" & Me.cboEvent & "'"

Exit_cmdMyButton_Click:
Exit Sub

Err_cmdMyButton_Click:
MsgBox Err.Number & Err.Description
Resume Exit_cmdMyButton_Click

End Sub

Hope I understood your request. If not post back!

--
Reggie

----------
"Pasquale" <sp*****@NOTHNXtelusplanet.net> wrote in message news:DSAXc.47108$S55.4626@clgrps12...
How can I get a combo box to come up when previewing a report so that
the user can select an event name and then print preview the report
specific to that event?

In the "On Open" event of the report I've tried
'Forms![Events2]![EventName]' and in the text box of the report I have
the "control source" as '=Forms!Events2!EventName.Value'. Using these
results in '#Error' being displayed in where the text box is.

Any help or direction would be appreciated.

Pasquale

Nov 13 '05 #2

P: n/a
Pasquale <sp*****@NOTHNXtelusplanet.net> wrote in message news:<DSAXc.47108$S55.4626@clgrps12>...
How can I get a combo box to come up when previewing a report so that
the user can select an event name and then print preview the report
specific to that event?

In the "On Open" event of the report I've tried
'Forms![Events2]![EventName]' and in the text box of the report I have
the "control source" as '=Forms!Events2!EventName.Value'. Using these
results in '#Error' being displayed in where the text box is.

Any help or direction would be appreciated.

Pasquale


DO it the other way around. Open it from a an unbound form with the
combobox on it and then reference that in the filter.
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.