By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,482 Members | 2,451 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,482 IT Pros & Developers. It's quick & easy.

Global variable to change report title

P: n/a
I have a database project that I created with several forms and
reports. I would like to be able to declare a single title and be
able to change the title on all the forms and reports by changing a
single variable. I think this is possible, however I don't know
Visual Basic very well. I created a module named DBcommon with the
following statements in it:

Option Compare Database

Global Const DBname As String = "Title String"
Global Const DBaddr As String = "Address String"

I don't know how to reference these variables in a form or report.
I would appreciate any help or tips on where to go to find a solution.

Thanks in advance for helping!

Derek
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Derek, you could use the Open event of every form and report to:
Me.Caption = DBName

However, this doesn't seem like a very useful idea. The form/report caption
would be better providing the user with information about where in the
program they currently are (a unique name), and would also allow the user to
select from on of several open forms/reports on the Window menu.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"DerekM" <de*********@hotmail.com> wrote in message
news:da**************************@posting.google.c om...
I have a database project that I created with several forms and
reports. I would like to be able to declare a single title and be
able to change the title on all the forms and reports by changing a
single variable. I think this is possible, however I don't know
Visual Basic very well. I created a module named DBcommon with the
following statements in it:

Option Compare Database

Global Const DBname As String = "Title String"
Global Const DBaddr As String = "Address String"

I don't know how to reference these variables in a form or report.
I would appreciate any help or tips on where to go to find a solution.

Thanks in advance for helping!

Derek

Nov 12 '05 #2

P: n/a
Allen,

Thanks for your quick reply. I guess I didn't phrase my situation
very well. I am trying to change the Company Name on the report,
which I mis-identified as the Title of the report. I found a way to
make it work, but was curious what was considered best practices. I
put the Company name in a text box and created a module with a public
function returning the string Company name. The code looks like this.

Public Function CompanyName() As String
On Error Resume Next
CompanyName = "Company1, LLC"
End Function

Is there a better way to achieve this result? Something that would be
considered best practices?

Thanks for your help.

Derek Moore
"Allen Browne" <al*********@SeeSig.invalid> wrote in message news:<el********************@news-server.bigpond.net.au>...
Derek, you could use the Open event of every form and report to:
Me.Caption = DBName

However, this doesn't seem like a very useful idea. The form/report caption
would be better providing the user with information about where in the
program they currently are (a unique name), and would also allow the user to
select from on of several open forms/reports on the Window menu.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"DerekM" <de*********@hotmail.com> wrote in message
news:da**************************@posting.google.c om...
I have a database project that I created with several forms and
reports. I would like to be able to declare a single title and be
able to change the title on all the forms and reports by changing a
single variable. I think this is possible, however I don't know
Visual Basic very well. I created a module named DBcommon with the
following statements in it:

Option Compare Database

Global Const DBname As String = "Title String"
Global Const DBaddr As String = "Address String"

I don't know how to reference these variables in a form or report.
I would appreciate any help or tips on where to go to find a solution.

Thanks in advance for helping!

Derek

Nov 12 '05 #3

P: n/a
Allen,

Thanks for your quick reply. I guess I didn't phrase my situation
very well. I am trying to change the Company Name on the report,
which I mis-identified as the Title of the report. I found a way to
make it work, but was curious what was considered best practices. I
put the Company name in a text box and created a module with a public
function returning the string Company name. The code looks like this.

Public Function CompanyName() As String
On Error Resume Next
CompanyName = "Company1, LLC"
End Function

Is there a better way to achieve this result? Something that would be
considered best practices?

Thanks for your help.

Derek Moore
"Allen Browne" <al*********@SeeSig.invalid> wrote in message news:<el********************@news-server.bigpond.net.au>...
Derek, you could use the Open event of every form and report to:
Me.Caption = DBName

However, this doesn't seem like a very useful idea. The form/report caption
would be better providing the user with information about where in the
program they currently are (a unique name), and would also allow the user to
select from on of several open forms/reports on the Window menu.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"DerekM" <de*********@hotmail.com> wrote in message
news:da**************************@posting.google.c om...
I have a database project that I created with several forms and
reports. I would like to be able to declare a single title and be
able to change the title on all the forms and reports by changing a
single variable. I think this is possible, however I don't know
Visual Basic very well. I created a module named DBcommon with the
following statements in it:

Option Compare Database

Global Const DBname As String = "Title String"
Global Const DBaddr As String = "Address String"

I don't know how to reference these variables in a form or report.
I would appreciate any help or tips on where to go to find a solution.

Thanks in advance for helping!

Derek

Nov 12 '05 #4

P: n/a
There are usually a number of these entries: Company name, address, phone
number, fax, web, email, and various other user preferences you need to
store. A simple solution is to create a system table to hold the values:
- a field to hold the variable name (e.g. "CompanyName"),
- a field to hold the value (e.g. "Company1, LLC")
If you allow the user to change entries, you may also want:
- a field to hold a description (so the user knows what they are changing).
- a boolean field for system values that can't be deleted or renamed
(IsSystem)
- a boolean field for hidden entries (IsHidden) filtered by a query
- a field that defines the kind of data appropriate to this field (tested
with IsNumeric(), IsDate() etc before an entry is accepted).

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"DerekM" <de*********@hotmail.com> wrote in message
news:da**************************@posting.google.c om...
Allen,

Thanks for your quick reply. I guess I didn't phrase my situation
very well. I am trying to change the Company Name on the report,
which I mis-identified as the Title of the report. I found a way to
make it work, but was curious what was considered best practices. I
put the Company name in a text box and created a module with a public
function returning the string Company name. The code looks like this.

Public Function CompanyName() As String
On Error Resume Next
CompanyName = "Company1, LLC"
End Function

Is there a better way to achieve this result? Something that would be
considered best practices?

Thanks for your help.

Derek Moore
"Allen Browne" <al*********@SeeSig.invalid> wrote in message

news:<el********************@news-server.bigpond.net.au>...
Derek, you could use the Open event of every form and report to:
Me.Caption = DBName

However, this doesn't seem like a very useful idea. The form/report caption would be better providing the user with information about where in the
program they currently are (a unique name), and would also allow the user to select from on of several open forms/reports on the Window menu.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"DerekM" <de*********@hotmail.com> wrote in message
news:da**************************@posting.google.c om...
I have a database project that I created with several forms and
reports. I would like to be able to declare a single title and be
able to change the title on all the forms and reports by changing a
single variable. I think this is possible, however I don't know
Visual Basic very well. I created a module named DBcommon with the
following statements in it:

Option Compare Database

Global Const DBname As String = "Title String"
Global Const DBaddr As String = "Address String"

I don't know how to reference these variables in a form or report.
I would appreciate any help or tips on where to go to find a solution.

Thanks in advance for helping!

Derek

Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.