473,387 Members | 1,464 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,387 software developers and data experts.

Parameter value field in access that can be passed?

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.
Apr 24 '07 #1
10 1777
MMcCarthy
14,534 Expert Mod 8TB
In a module create a Global variable to hold the date.

Expand|Select|Wrap|Line Numbers
  1. Global myDate As Date
When you enter the date set the value to this variable.

Now put a function in a module to return the date
Expand|Select|Wrap|Line Numbers
  1. Function getmyDate()
  2.  
  3.    getmyDate = myDate
  4.  
  5. End Function
  6.  
Now set this function as the criteria for the queries.

Expand|Select|Wrap|Line Numbers
  1. getmyDate()
Mary
Apr 25 '07 #2
In a module create a Global variable to hold the date.

Expand|Select|Wrap|Line Numbers
  1. Global myDate As Date
When you enter the date set the value to this variable.

Now put a function in a module to return the date
Expand|Select|Wrap|Line Numbers
  1. Function getmyDate()
  2.  
  3.    getmyDate = myDate
  4.  
  5. End Function
  6.  
Now set this function as the criteria for the queries.
Many thanks - I shall give it a go.
Expand|Select|Wrap|Line Numbers
  1. getmyDate()
Mary
Many thanks I shall give it a go
Apr 25 '07 #3
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
Apr 25 '07 #4
MMcCarthy
14,534 Expert Mod 8TB
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:
Expand|Select|Wrap|Line Numbers
  1. Global strSQL As String
  2. 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
Apr 25 '07 #5
NeoPa
32,556 Expert Mod 16PB
Global Variables:

Have to be declared in a module (not a form module) as follows:
Expand|Select|Wrap|Line Numbers
  1. Global strSQL As String
  2. 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.
Expand|Select|Wrap|Line Numbers
  1. Public strSQL As String
  2. Public intVar As Integer
May 1 '07 #6
MMcCarthy
14,534 Expert Mod 8TB
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.
Expand|Select|Wrap|Line Numbers
  1. Public strSQL As String
  2. Public intVar As Integer
Good to know :)
May 1 '07 #7
Good to know :)
If I understood what you are saying I would respond:)
Regards,
Hugh
May 2 '07 #8
NeoPa
32,556 Expert Mod 16PB
Don't worry about our prattle Hugh.
Do you understand enough of Mary's post to implement it?
May 2 '07 #9
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
May 8 '07 #10
NeoPa
32,556 Expert Mod 16PB
Try going back to post #5 Hugh.
If you find that you can't follow it, let us know where you get stuck and we can lead you from there.
May 8 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

2
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)
3
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...
7
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...
2
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...
1
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...
16
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...
11
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 =...
0
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...
5
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.