Open Report From TextBox

D

DS

I'm trying to open a report from a textbox. What is the syntax for this?
DoCmd.OpenReport "' & Me.Textbox.Value & '", acViewPreview
Thanks
DS
 
L

Larry Linson

DS said:
I'm trying to open a report from a textbox. What is the syntax for this?
DoCmd.OpenReport "' & Me.Textbox.Value & '", acViewPreview
Thanks

I have seen people display a list of their reports in a Combo or List Box.
I've never seen an experienced Access developer force the user to type in
the name of the report into a Text Box. Can you explain _why_ you would do
that?

In a sample application I have, the Combo Box "Combo0" contains a value list
of Reports from which the user can choose and the following code opens the
chosen Report in Preview.

Private Sub Combo0_AfterUpdate()

DoCmd.OpenReport Me!Combo0, acViewPreview

End Sub

Those are sample (test) reports demonstrating various features of Access
Reports.

In my real-world applications most Reports are opened on only the required
subset of the Records, so would not have such a simple DoCmd.OpenReport --
the DoCmd.OpenReport in that case would have a WhereCondition argument, or a
filter, specified.

Larry Linson
Microsoft Office Access MVP
 
D

DS

Hi Larry.
The report is being selected from a listbox. The name of the report is the
transfered to the textbox. When they click on a command button the report
opens. Do I not really need the textbox and open it directly from the
listbox? In any case how what is the syntax from the textbox. I assume the
listbox would be.
DoCme.OpenReport Me.Listbox.(2), acViewPreview
Thanks
DS
 

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