473,545 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combine queries in vba

I have query1 where I set a date range. Query2 is a crosstab query and is based on query1. I don't want the queries to be saved in the mdb but I do want them to be run in VBA using a querystring. If I only put query2 in the querystring it refers to query1 which is not available in the database. How can I combine the 2 queries into one querystring?

Thank you,
John
Nov 30 '07 #1
4 2072
On Nov 30, 8:09 am, <joh...@johnie. comwrote:
I have query1 where I set a date range. Query2 is a crosstab query and is based on query1. I don't want the queries to be saved in the mdb but I do want them to be run in VBA using a querystring. If I only put query2 in the querystring it refers to query1 which is not available in the database. How can I combine the 2 queries into one querystring?

Thank you,
John
Instead of combining the queries to obtain a more complex query,
consider leaving in the name of the query contained in the other
database. See:

http://groups.google.com/group/micro...639becbdf2faee

James A. Fortune
CD********@Fort uneJames.com
Dec 2 '07 #2
On Dec 1, 8:30 pm, CDMAPos...@fort unejames.com wrote:
Instead of combining the queries to obtain a more complex query,
consider leaving in the name of the query contained in the other
database. See:

http://groups.google.com/group/micro...msg/ef639becbd...
On second thought I don't think this will work. The changes have to
be made in an identical query in the current database that references
the table(s) in the other database. Lyle's syntax from a similar post
to combine the queries is good, but crosstab queries can get complex
enough without having to interact with subqueries. If you are
confortable combining the queries then do that.

James A. Fortune
CD********@Fort uneJames.com
Dec 2 '07 #3
On Dec 1, 9:17 pm, CDMAPos...@fort unejames.com wrote:
On second thought I don't think this will work. The changes have to
be made in an identical query in the current database that references
the table(s) in the other database.
I just tested this out by calling a query in a separate database using
that syntax. My original suggestion works.

James A. Fortune
CD********@Fort uneJames.com
Dec 2 '07 #4
Thanks James. My initial post wasn't very clear so I posted another. I got
it working now.
John

<CD********@for tunejames.comsc hreef in bericht
news:42******** *************** ***********@w28 g2000hsf.google groups.com...
On Nov 30, 8:09 am, <joh...@johnie. comwrote:
>I have query1 where I set a date range. Query2 is a crosstab query and is
based on query1. I don't want the queries to be saved in the mdb but I do
want them to be run in VBA using a querystring. If I only put query2 in
the querystring it refers to query1 which is not available in the
database. How can I combine the 2 queries into one querystring?

Thank you,
John

Instead of combining the queries to obtain a more complex query,
consider leaving in the name of the query contained in the other
database. See:

http://groups.google.com/group/micro...639becbdf2faee

James A. Fortune
CD********@Fort uneJames.com

Dec 2 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1746
by: Chris Lutka | last post by:
I've been racking my brains all day over this. And I'm not the best at SQL either. I need a query that will produce the following results: Product,Warehouse,Sold_LastYear,Sold_ThisYear,Sold_3Months,Sold_MTD I've got four queries to give me the Sold_* fields. Their fields are Product, Warehouse, and Units. I also have a table which...
5
12976
by: Jamie Pittman via AccessMonster.com | last post by:
I have two tables with 5000 entries on them. One is based for regular time with several variables example (employee name, date,time in and out, code, customer, building) I have another table that works with overtime but has the same feilds within the table. I want to be able to run a report that combines the regular time and overtime for the...
4
5737
by: Jason Gyetko | last post by:
Is there any way to combine these two queries into one? I have tables Item_Master & Kit_Master which are the source tables. Query 2 is using both Item_Master (table) & qryKit1 (query) & Kit_Master (table) as its record source because the Kit_Master table has 2 fields in it that get joined back to the same field in Item_Master. Item_Master...
1
1437
by: Will | last post by:
Hi all I have a table, where there's AutoID, Name of Person (looked up from tblPerson), Name of Dispute (looked up from tblDispute), Date, Details (Memo). What I have is another table that need to look up to records in this table, but I couldn't because Access wouldn't let me look up just an AutoID on its own... So I created a new field...
4
4206
by: PlayHard | last post by:
I want my output in two columns like this: C_INCIDENT_TYPE \ TOTAL COUNT How do I combine my two queries to get result. First Query SELECT C_INCIDENT_TYPE, COUNT (*)
46
3067
by: dude88888 | last post by:
Hello I have one query where i get the total number of units for an entire fund say fund 89 has 1000 total units Then i need to find out how much of the total fund each user has say user 6 has 500 units say user 7 has 400 units
1
3153
by: csolomon | last post by:
Hello: I am using two queries to get one result set. The issue is, I return no data when I combine them into one query. I have listed both queries, as well as the 3rd query that shows them combined. **Max Date/Time Query-Finds the most recent updated record based on the time and date (Correct Results Returned) SELECT .panelNumber,...
2
1596
by: bips2005 | last post by:
i have got two queries, $sql1 = "select cust_id from customer where comp_name = '$compname'"; $result = $DB->query($sql1); $result->fetchInto($row); $sql = "select expirydate from customer l,domain s where l.cust_id = '$row' and s.domname = '$domname'"; the first query retrieves cust_id from the table customer and i use it in the...
13
3235
by: MNNovice | last post by:
I have three tables, tblAP, tblPayroll and tblAllocation. Each records three separate expenses. All three are related by FK ECHOID, each has common fields such as AccountNo, FundNo, GrantNo, SubClassNo, ProjectNo and Amount Originally I created these 3 and was able to generate combined reports using queries. But I have been unable to use...
0
7479
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, 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...
0
7411
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...
0
7669
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7926
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...
1
7439
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...
0
7773
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...
0
5987
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3468
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...
1
1028
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.