Hello, is there a parameter value field in access that can be passed between queries, forms and reports?
For example, we have two companies both selling the same products. To extract data we have to enter the date twice, once for each company. To print a report we have to enter the date again. Is it possible to enter the date once which can be used by all the processes?
Thanks for your help.
10 1793 MMcCarthy 14,534
Recognized Expert Moderator MVP
In a module create a Global variable to hold the date.
When you enter the date set the value to this variable.
Now put a function in a module to return the date -
Function getmyDate()
-
-
getmyDate = myDate
-
-
End Function
-
Now set this function as the criteria for the queries.
Mary
In a module create a Global variable to hold the date.
When you enter the date set the value to this variable.
Now put a function in a module to return the date -
Function getmyDate()
-
-
getmyDate = myDate
-
-
End Function
-
Now set this function as the criteria for the queries.
Many thanks - I shall give it a go.
Mary
Many thanks I shall give it a go
Many thanks I shall give it a go
Hello,
I have tried reading up on global variables without much success! I am afraid that it will take me a bit longer before I can work them out.
Thanks
MMcCarthy 14,534
Recognized Expert Moderator MVP
Hello,
I have tried reading up on global variables without much success! I am afraid that it will take me a bit longer before I can work them out.
Thanks
Global Variables:
Have to be declared in a module (not a form module) as follows: -
Global strSQL As String
-
Global intVar As Integer
If you have a few of these you can create a module just to hold them.
Once you have declared the variable you can use it anywhere in your code
Example:
strSQL = "SELECT * FROM TableName"
You don't have to declare the variable locally with Dim.
strSQL will hold this value until you change it regardless of whether you close the form.
Mary
NeoPa 32,567
Recognized Expert Moderator MVP Global Variables:
Have to be declared in a module (not a form module) as follows: -
Global strSQL As String
-
Global intVar As Integer
This is perfectly correct but the recommended way of declaring the global variables is now to use the Public keyword rather than the earlier Global keyword.
They will both work at the moment (in current versions that is) but Global is earmarked for extinction. - Public strSQL As String
-
Public intVar As Integer
MMcCarthy 14,534
Recognized Expert Moderator MVP
This is perfectly correct but the recommended way of declaring the global variables is now to use the Public keyword rather than the earlier Global keyword.
They will both work at the moment (in current versions that is) but Global is earmarked for extinction. - Public strSQL As String
-
Public intVar As Integer
Good to know :)
Good to know :)
If I understood what you are saying I would respond:)
Regards,
Hugh
NeoPa 32,567
Recognized Expert Moderator MVP
Don't worry about our prattle Hugh.
Do you understand enough of Mary's post to implement it?
Don't worry about our prattle Hugh.
Do you understand enough of Mary's post to implement it?
Unfortunately not. I do not understand VB although I am trying to find a course. I have read a book on Access but this is fairly basic so I have a lot to learn.
Hugh
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Marcin |
last post by:
Hello!
Is there any method to detect parameters values passed to
called method?
For example:
public Guid ApplicationLogin(string userName, string
password, int dbId)
|
by: MX1 |
last post by:
I'm ready to pull the hair out of my head. I have a query with a couple of
parameters that I want to get from combo boxes on a form. One parameter is
a date with a dynamically calculated year and the other is criteria for a
Yes or No field. I'll focus on the Yes/No field for simplicity.
If I run the query with the criteria hard coded as either "YES" or "NO", it
works.
In the values of the combo box in my form, I have it set as...
|
by: Richard Grant |
last post by:
Hi. In c/C++ i can pass the address of a subroutine to another subroutine as an actual parameter
How do I do that in VB .NET
What should be the syntax for a parameter to receive the address of a subroutine
Let's say theres a sub that creates buttons and I want it to receive as a parameter the address of the sub that handles the OnClick event for the button being created
How do I pass such a parameter
Thanks in advance
Richar
|
by: Damon |
last post by:
Help! Need this fixed ASAP.
I have a GridView/DetailsView master/details form set up, with both
bound to separate ObjectDataSource objects. Both the GridView and the
DetailsView have a DataKeyNames parameter of "UserCompany,
BillableCompany". The DetailsView has control parameters for its
select method pointing to these two keys on the GridView. But the
select method function receives two copies of the UserCompany field!
The...
|
by: David Shorthouse |
last post by:
Hey folks,
I am attempting to pass null as the input value from a series of
textboxes if the user does not input a value prior to submit. To try and do
this, I am using a vbscript function on this asp as follows:
CommentsAdd = IIf(Request.Form("Comments")="",NULL,Request.Form("Comments"))
I was hoping this would convert those emptystring textboxes to null.
| |
by: hzmonte |
last post by:
Correct me if I am wrong, declaring formal parameters of functions as
const, if they should not be/is not changed, has 2 benefits;
1. It tells the program that calls this function that the parameter
will not be changed - so don't worry.
2. It tells the implementor and the maintainer of this function that
the parameter should not be changed inside the function. And it is for
this reason that some people advocate that it is a good idea to...
|
by: pamelafluente |
last post by:
Hi I am executing some simple sample code:
Using OleDbCommand As New OleDbCommand(Me.DBQuery.Text,
Me.OleDbConnection)
Dim OleDbParameter As OleDbParameter =
OleDbCommand.Parameters.Add("@Pinco", OleDbType.VarWChar)
OleDbParameter.Direction = ParameterDirection.Input
OleDbParameter.Value = "Berlin"
|
by: =?Utf-8?B?UGF1bA==?= |
last post by:
I have a ListBox server control named "lb_dates" with a SelectionMode of
"Multiple". The user can select multiple dates from the listbox.
I have ObjectDataSource named "ods_rfq" with a ControlParameter that has a
ControlID that points to "lb_dates". The PropertyName of the ControlParameter
is "SelectedValue".
The user selects two dates from the ListBox.
I am trying to pass BOTH selected values of the ListBox to a SelectMethod of
|
by: Trevisc |
last post by:
Happy Thursday Everyone,
I am trying to create a parameter that is one long varchar but that
will be used in a SQL statement IN function:
//string queryString = GetCurrentTitles();
//Below is for Test
string queryString = "45322,32222,33344,55555";
dataset catalogDS = new dataset();
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |