473,756 Members | 8,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query Criteria

64 New Member
Is there a method to pass along a criteria argument directly to the query criteria rather than through filtering a form or report?

In other words, I would like to click a "print" button and in the "on click" procedure pass along the criteria to the query to generate this report. Then I wouldn't have to create so mahy different queries. I know that I can take a control value to use in the criteria box in the query. But I would like to be able to use that same query from several different forms. I hope I'm not overlooking the obvious.

Thanks

-Tom
Nov 30 '07 #1
4 1614
Rabbit
12,516 Recognized Expert Moderator MVP
Is there a method to pass along a criteria argument directly to the query criteria rather than through filtering a form or report?

In other words, I would like to click a "print" button and in the "on click" procedure pass along the criteria to the query to generate this report. Then I wouldn't have to create so mahy different queries. I know that I can take a control value to use in the criteria box in the query. But I would like to be able to use that same query from several different forms. I hope I'm not overlooking the obvious.

Thanks

-Tom
You could use global variables. But to call a global variable from a query you also need a function to return the value.
Nov 30 '07 #2
tbeers
64 New Member
You could use global variables. But to call a global variable from a query you also need a function to return the value.
How would you create a global variable and what can you give me a short version of code to create the function?

Thanks

-Tom
Dec 1 '07 #3
Rabbit
12,516 Recognized Expert Moderator MVP
It's global as long as you put it in a non form module.
Dec 3 '07 #4
MMcCarthy
14,534 Recognized Expert Moderator MVP
Also instead of using Dim to declare your variable you declare it with the word Public.

e.g.

Public str As String
Dec 11 '07 #5

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

Similar topics

3
4987
by: Steve | last post by:
Form FrmRestock's recordsource is QryFrmRestock. The TransactionDate field's criteria is set ats: Forms!FrmRestock!LastXDays. LastXDays on the form is a combobox where the selections are 30, 60 and 90. The default is set at 30. Question1: When the form opens, there are no records displayed although there are many records that fit the criteria of 30. If I put a button on the form to do a requery and press the button, all the records...
6
7137
by: Andy | last post by:
Hello, I am having many problems with setting up a parameter query that searches by the criteria entered or returns all records if nothing is entered. I have designed an unbound form with 3 fields on it: Date (DateSpan1 and DateSpan2), Originator, and GroupName. I have added a button that triggers a query and uses those fields as its parameter criteria to populate a form. The user must be allowed to either enter all of the
3
1637
by: Pea | last post by:
Is it possible to get the average in a query where I have multiple criteria? Here's an abbreviated example of the query in design view: Fields: USERID DATE TIME ID_TYPE Criteria: <>JoeSchmo <>*2003 <7AM <>this and <>that Criteria: <>JoeSchmo <>*2003 7-9AM <>this and <>that Criteria: <>JoeSchmo <>*2003 9-11AM <>this and <>that Question: is it possible to get a total count...
5
11447
by: SuffrinMick | last post by:
Hello - I'm a newbie to coding! I'm working on an access 2000 database which has three tables: tblContacts - A list of customer contacts. tblOrgTypes - A list of organisational types. tblPositions - A list of job descriptions (Contacts can hold more than one position) I want to use a multi-select list box (Containing alphabetical list of positions) to run a query. HELP!
2
2537
by: Matthew | last post by:
Hey , I have built a query which takes values from unbounded fields on a form, and it all works except for one thing. I have a few fields in my query that are dates. I also have a start and end date and time on my form. So, a user will specify the start and end date, and also, the user has the option of checking which of the time fields from the query will have these dates as criteria. So, one of the date fields in my query is...
0
3517
by: starace | last post by:
I have designed a form that has 5 different list boxes where the selections within each are used as criteria in building a dynamic query. Some boxes are set for multiple selections but these list boxes do not necessarily need to have a selection made to be used in the dynamic query. In essence the form can have selections made in all or none of its list boxes to form the dynamic query I am looking to get some feedback in reference to...
0
2172
by: MLH | last post by:
I have an A97 query (qryVehiclesNowners2) that has a table field in it named . Depending on the selections made in a number of criteria choices on a form, a field on the form will have string values in it like... Between #12/1/2004# And #12/31/2004# - or - >= #6/10/2005# - or - Between #6/1/2005# And #6/30/2005# I want to use them as criteria for the query.
3
3302
by: MLH | last post by:
Am repeating question with different subject heading, perhaps stating more clearly my problem... I have an A97 query (qryVehiclesNowners2) that has a table field in it named . Depending on the selections made in a number of criteria choices on a form, a field on the form will have string values in it like... Between #12/1/2004# And #12/31/2004# - or - >= #6/10/2005# - or -
6
2563
by: Vince | last post by:
Hello all, I am using Visual Basic to open a saved query and then save information in the query to an array for later use. The problem is that the same query shows different results when opened directly vs. when opened by Visual Basic. It is as if Visual Basic is not letting the query fully evaluate before processing records. The query is a subtotal query that contains several criteria set up as "where" in the group-by box. Most of...
6
7035
by: jmarcrum | last post by:
Hi! I have created a Union Query in ACCESS 2003, that combines 130 records from one query (Extra Foreman Radios) and 250 records from another query (Forman Main Radios). I have created a continuous form and used the Union query (qryRadioDataUnion) as my record source. My question is...how would i apply a filter to that query record source to allow the user to limit the search results down to an individual contractor, radio type, SIM card...
0
9275
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9873
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 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...
0
9713
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 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...
1
7248
isladogs
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...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3806
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
bsmnconsultancy
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...

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.