dbTalk Databases Forums  

combo box select when opening report

comp.database.ms-access comp.database.ms-access


Discuss combo box select when opening report in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Pasquale
 
Posts: n/a

Default combo box select when opening report - 08-27-2004 , 01:52 AM






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


Reply With Quote
  #2  
Old   
Reggie
 
Posts: n/a

Default Re: combo box select when opening report - 08-27-2004 , 03:05 AM






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" <spdrweb (AT) NOTHNXtelusplanet (DOT) net> wrote

Quote:
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




Reply With Quote
  #3  
Old   
Pieter Linden
 
Posts: n/a

Default Re: combo box select when opening report - 08-27-2004 , 07:28 AM



Pasquale <spdrweb (AT) NOTHNXtelusplanet (DOT) net> wrote

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


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.