Prompt for report name (2 Viewers)

kitty77

Registered User.
Local time
Today, 16:24
Joined
May 27, 2019
Messages
715
Is it possible to get prompted to enter the report name instead of what I'm using?

strDocName = "Report-BA"
DoCmd.OpenReport strDocName, acViewReport, , strWhere

Thanks.
 
Could you provide me with an example?
 
You should be able to make the title box on the report unbound and then assign it a name not in the underlying datasource:

Set it's control source to:

=[Enter Report Name]
 
You absolutely do not want to prompt for the report name. Internal object names should never include spaces or other special characters and users should only see user-friendly names. Therefore, the simplest solution is to provide a combo box for the user to choose from. Here's a sample you might find useful. It goes far beyond what you asked for.

 
I agree with Pat. I would not use prompts for anything is Access including object names, InputBox(), and query parameters. The closest I come to prompts is MsgBox().
 
I agree and here's why.

People are really good at recognizing and interpreting patterns. We are not so good at remembering exact details. (e.g. is that report name "rptQuarterlyMaintencebySector", or rptQuarterlySectorMaintenance"?) We can remember it has something to do with a time period, an activity and an area.

Computers, on the other hand, and Access specifically, are really, really good at the details. One letter off in a report name and it no longer matches as far as Access is concerned.

That's why I don't open a parameter input box and ask users to remember the details about the name of the report. That's why I show the user a combo or list box with a familiar name they can spot easily, and a hidden column for the specific report name Access needs to do its job.
 
Basic rule number number one of programming: Totally control the users and stop them from messing the job up.
This is the total opposite. You'll spend hours on support calls with idiots telling you over and over they've definitely typed the name correctly.
 
@kitty77 - as you can see, the opinion here is overwhelming - and based on an accumulation of probably over 100 years of total experience (if you include me). Your better choice is to give your users an explicitly spelled-out chance to choose from a list rather than giving them a direct input ability that has good odds of causing an error to pop up because of possible errors in the name.

If you think your users will be unhappy for not having the chance to type in a raw, unfiltered name, just think of how irate they will be when Access takes a fatal error because it pops up the dreaded Debug-or-End Program box - from which the only recovery is to close Access and start over again.
 

Users who are viewing this thread

Back
Top Bottom