VBA masks?

narotosensei

Access Neophyte
Local time
Today, 14:02
Joined
Nov 14, 2009
Messages
12
I want to know if you can put form names through a mask made in VBA to display a different name. I am using MSysObjects to look up my forms and reports, and it returns the name but I think the name is a little too confusing for users (the prefix like frm or rpt and the underscores). I am hoping to make it look more professional. I'm not very experienced in VBA. Any ideas?
 
I want to know if you can put form names through a mask made in VBA to display a different name. I am using MSysObjects to look up my forms and reports, and it returns the name but I think the name is a little too confusing for users (the prefix like frm or rpt and the underscores). I am hoping to make it look more professional. I'm not very experienced in VBA. Any ideas?

Two ideas:

1. Create a table and have a field for the real name and a field for the "friendly name" and then display the friendly name but use the other field for opening.

2. I sometimes use friendly names (except adding rpt_ in front of the reports and here's a sample I did which shows how I use that. I never have to use a table for names that way.
 
I'm gonna try the first one, thanks for the great ideas :)
 
I'm trying to figure out how to do the first one...
Can you help me out?
 
1. You have a table with 3 fields:
tblReportsList
ReportID - Autonumber (PK)
ReportName - Text (real name of report)
ReportDisplayName - Text (pretty name)

2. Then you use the SQL like this to set the row source for your combo or listbox:

SELECT ReportName, ReportDisplayName
FROM tblReportsList
OrderBy ReportDisplayName

3. Set the combo or listbox's column Count to 2 and then set the column widths to 0";2" so that the actual name doesn't show but the pretty name does.

4. Make the selection and then in a click event of a command button or the After Update event of the combo or listbox you can use:

DoCmd.OpenReport Me.YourComboOrListBoxName, acViewPreview
 
okay, but how do i do this with forms/report objects? Is there a function that allows me to select all the forms, then set each form name equal to their form caption?
 
okay, but how do i do this with forms/report objects? Is there a function that allows me to select all the forms, then set each form name equal to their form caption?

No, you would need to add them to the table manually, if you are using that method.
 
The easiest method is to open the form or report in the design view and using the properties of the form or report change the caption to your required name. If the caption is null then the default caption value is the name of the form or report etc.
 

Users who are viewing this thread

Back
Top Bottom