Launching a report from a Text Box

J

Joe

I bothered everyone on launching a report from a Combo Box on Friday. That
did not give me exactly what I wanted but it did work. I would like to have
all of the reports which I have listed in a Table appear on the screen with
their description. *****Mission completed.*****
I assumed that I could change my Combo Box [event procedure] to use a Text
Box. The text box is Called "Report Name". I see that Combo Boxes are
numbered(Combo0") Text boxes are not. I also want to use a "Double Click" as
the event starter.
The event looks like this:

Report_Name DblClick
Private Sub Report_Name_DblClick(Cancel As Integer)
DoCmd.OpenReport Report Name, acViewPreview
End Sub

Report name above was "Me.Combo0" in the original using a combo Box.
 
J

Joe

I think I got it It did not like the space between the words "Report Name"
changed it to "Report_Name"
 
D

Douglas J. Steele

All controls are numbered if you add them from the tool box.

The reason many (most?) text boxes aren't numbered is because they're
created as bound controls, so pick up the name of the recordset field to
which they're bound.

That having been said, it's generally recommended that you rename all
controls to give them meaningful names. Does Combo0 tell you anything about
what's displayed in the control? Of course not. That's why you'd rename the
control to something like cboReportNames

Select the text box of interest to you, and look at the Properties tab.
That'll not only give the name of the control, but it'll also let you
associate code with it: look on the Events tab, set the On Dbl Click
property to [Event Procedure] then click on the ellipsis (...) to the right
of the property. That'll take you into the VB Editor, in the middle of

Private Sub NameOfControl_DblClick(Cancel As Integer)

End Sub
 
J

John Spencer

Try

Private Sub Report_Name_DblClick(Cancel As Integer)
DoCmd.OpenReport Me.Report_Name, acViewPreview
End Sub

Better yet try editing the name of the control to txtReportName and then use

DoCmd.OpenReport Me.txtReportName, acViewPreview


--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
J

Joe

Thanks for the input. Now I have another Question. I would like to use a
comand button to close the form and return to the switchboard . I see "Open
switchBoard" but how do I close the form?

Douglas J. Steele said:
All controls are numbered if you add them from the tool box.

The reason many (most?) text boxes aren't numbered is because they're
created as bound controls, so pick up the name of the recordset field to
which they're bound.

That having been said, it's generally recommended that you rename all
controls to give them meaningful names. Does Combo0 tell you anything about
what's displayed in the control? Of course not. That's why you'd rename the
control to something like cboReportNames

Select the text box of interest to you, and look at the Properties tab.
That'll not only give the name of the control, but it'll also let you
associate code with it: look on the Events tab, set the On Dbl Click
property to [Event Procedure] then click on the ellipsis (...) to the right
of the property. That'll take you into the VB Editor, in the middle of

Private Sub NameOfControl_DblClick(Cancel As Integer)

End Sub

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Joe said:
I bothered everyone on launching a report from a Combo Box on Friday. That
did not give me exactly what I wanted but it did work. I would like to
have
all of the reports which I have listed in a Table appear on the screen
with
their description. *****Mission completed.*****
I assumed that I could change my Combo Box [event procedure] to use a Text
Box. The text box is Called "Report Name". I see that Combo Boxes are
numbered(Combo0") Text boxes are not. I also want to use a "Double Click"
as
the event starter.
The event looks like this:

Report_Name DblClick
Private Sub Report_Name_DblClick(Cancel As Integer)
DoCmd.OpenReport Report Name, acViewPreview
End Sub

Report name above was "Me.Combo0" in the original using a combo Box.
 
D

Douglas J. Steele

DoCmd.Close acForm, "switchBoard", Save:=acNo

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Joe said:
Thanks for the input. Now I have another Question. I would like to use a
comand button to close the form and return to the switchboard . I see
"Open
switchBoard" but how do I close the form?

Douglas J. Steele said:
All controls are numbered if you add them from the tool box.

The reason many (most?) text boxes aren't numbered is because they're
created as bound controls, so pick up the name of the recordset field to
which they're bound.

That having been said, it's generally recommended that you rename all
controls to give them meaningful names. Does Combo0 tell you anything
about
what's displayed in the control? Of course not. That's why you'd rename
the
control to something like cboReportNames

Select the text box of interest to you, and look at the Properties tab.
That'll not only give the name of the control, but it'll also let you
associate code with it: look on the Events tab, set the On Dbl Click
property to [Event Procedure] then click on the ellipsis (...) to the
right
of the property. That'll take you into the VB Editor, in the middle of

Private Sub NameOfControl_DblClick(Cancel As Integer)

End Sub

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Joe said:
I bothered everyone on launching a report from a Combo Box on Friday.
That
did not give me exactly what I wanted but it did work. I would like to
have
all of the reports which I have listed in a Table appear on the screen
with
their description. *****Mission completed.*****
I assumed that I could change my Combo Box [event procedure] to use a
Text
Box. The text box is Called "Report Name". I see that Combo Boxes are
numbered(Combo0") Text boxes are not. I also want to use a "Double
Click"
as
the event starter.
The event looks like this:

Report_Name DblClick
Private Sub Report_Name_DblClick(Cancel As Integer)
DoCmd.OpenReport Report Name, acViewPreview
End Sub

Report name above was "Me.Combo0" in the original using a combo Box.
 
J

Joe

Thank you all very much. I will post new on my next question.


John Spencer said:
Try

Private Sub Report_Name_DblClick(Cancel As Integer)
DoCmd.OpenReport Me.Report_Name, acViewPreview
End Sub

Better yet try editing the name of the control to txtReportName and then use

DoCmd.OpenReport Me.txtReportName, acViewPreview


--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Joe said:
I bothered everyone on launching a report from a Combo Box on Friday. That
did not give me exactly what I wanted but it did work. I would like to
have
all of the reports which I have listed in a Table appear on the screen
with
their description. *****Mission completed.*****
I assumed that I could change my Combo Box [event procedure] to use a Text
Box. The text box is Called "Report Name". I see that Combo Boxes are
numbered(Combo0") Text boxes are not. I also want to use a "Double Click"
as
the event starter.
The event looks like this:

Report_Name DblClick
Private Sub Report_Name_DblClick(Cancel As Integer)
DoCmd.OpenReport Report Name, acViewPreview
End Sub

Report name above was "Me.Combo0" in the original using a combo Box.
 

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

Top