Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / July 2006

Tip: Looking for answers? Try searching our database.

Access 97 - global variables??

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mr B - 20 Jul 2006 20:33 GMT
Hi guys,

Urgent problems that I need to sort before Monday, I will be so
grateful for ANY help received! I am not familiar with Microsoft Access
with Visual Basic, I only really practice basic C++.  I'm working on an
Access Application, and i have alot of repetitive variables for the
forms i use.  Is there a way of declaring these variables globally
instead of declaring them each time fresh in a new event procedure?
(Is it also possible to initialise them globally as these values are
constants throughout the database)?

Also, my database makes an ODBC connection to a back-end DB2 database
and I use make-table and append queries on ODBC Linked tables. I'd like
the user to not have to enter the connection details every time a query
is ran (Database name and password) I have seen examples for
pass-through queries, where on the query properties a ODBC connect
string is specified or a wizard is ran...but for whatever reason on
mine the only fields that bair a resemblance are a 'source connect str'
and 'dest connect str'??

Thanks alot
Daniel
Marshall Barton - 20 Jul 2006 22:50 GMT
>Urgent problems that I need to sort before Monday, I will be so
>grateful for ANY help received! I am not familiar with Microsoft Access
[quoted text clipped - 4 lines]
>(Is it also possible to initialise them globally as these values are
>constants throughout the database)?

Create a standard module with no procedures.  Just declare
your constants:

Public Const aaa As Long =123
Public Const sss As String = "qwerwer"

Signature

Marsh
MVP [MS Access]

Michel Walsh - 20 Jul 2006 23:11 GMT
Hi,

As for the first question, you can define variables in the declaration
section of a standard module, their scope will be the whole application, but
can be hidden by another declaration of the same variable name in a class,
or in a procedure.  You can use a database property to get them remembered
between runs of your applications. Here an example how to create one, read
it, and assign it.

CurrentDb.Properties.Append CurrentDb.CreateProperty("yoyo", dbText, "yo")

? CurrentDb.Properties("yoyo")
yo

CurrentDb.Properties("yoyo") = "rather not"

Hoping it may help,
Vanderghast, Access MVP

> Hi guys,
>
[quoted text clipped - 18 lines]
> Thanks alot
> Daniel
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.