473,415 Members | 1,566 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,415 software developers and data experts.

Global variable to change report title

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
4 13555
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Eric Lilja | last post by:
Hello, I have a few global variables in my program. One of them holds the name of the application and it's defined in a header file globals.hpp (and the point of definition also happen to be the...
2
by: semi | last post by:
I am pretty new to using C++ and I can't figure this out. I have class PTM that starts a thread. There is an array of structure to be shared between PTM class and thread function. For some...
6
by: memocan | last post by:
#include <iostream> using namespace std; int x; //global variable matrix int main() { x= new float ; //initialize the size now }
9
by: Shapper | last post by:
Hello, I am declaring a variable in my aspx.vb code as follows: Public Class catalogue Public productid As String Private Sub Page_Load ... I have an image button where I call the...
1
by: amit | last post by:
Hello Group, Does anybody know how I can have a global variable in an HTML file? for instance, I have a fuction (called aFunction() here) and during a mousedown or up event the function is going...
112
by: istillshine | last post by:
When I control if I print messages, I usually use a global variable "int silent". When I set "-silent" flag in my command line parameters, I set silent = 1 in my main.c. I have many functions...
3
by: MAHMAD337 | last post by:
Hi all, I want to declare a global variable in my report (build in oracle report builder). can any one tell what is the procedure to declare a global variable in oracle report builder. bye;
1
by: bullfrog83 | last post by:
I have a form that contains parameters for a report. After the user clicks Preview I have code that set's the Where clause for the report's record source. Once the report opens I close the parameter...
2
by: kstevens | last post by:
I have a global variable assigned in a module. Public MyVar as Integer Right before I open a report, I have the variable set. MyVar= InputBox("Please enter the markup percentage for oursource...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.