Chat with a LIVE Microsoft Access Expert!
 
       
 

         

   

Go Back   Access World Forums > Microsoft Access Discussion > Queries

 
 
Chat with a LIVE Microsoft Access Expert!
Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-31-2006, 07:22 AM
Scottyk537 Scottyk537 is offline
Registered User
 
Join Date: May 2006
Posts: 49
Scottyk537 is on a distinguished road
Input Criteria into Union query from a Form

Based on information from a earlier thread.... I created a Union query that pulls information from multiple tables and fields.


SELECT AG_B_R1 as Num FROM dbo_ADC_Ag_B_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_B_R2 FROM dbo_ADC_Ag_B_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_B_R3 FROM dbo_ADC_Ag_B_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_B_R4 FROM dbo_ADC_Ag_B_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_m_R1 FROM dbo_ADC_Ag_m_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_m_R2 FROM dbo_ADC_Ag_m_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_m_R3 FROM dbo_ADC_Ag_m_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_m_R4 FROM dbo_ADC_Ag_m_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_e_R1 FROM dbo_ADC_Ag_e_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_e_R2 FROM dbo_ADC_Ag_e_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_e_R3 FROM dbo_ADC_Ag_e_Res WHERE Rollnmbr=[roll]
UNION ALL SELECT AG_e_R4 FROM dbo_ADC_Ag_e_Res WHERE Rollnmbr=[roll];


And then I created another query to get the STDEV of the above query


SELECT StDev([Num]) AS StDev
FROM Q_cals_ag_bme_STDEV_Union;

The result will be on a subform on my main page. How do I get my form to input the [roll] automatically and requery the subform, showing my result.
Thanks
Reply With Quote
Sponsored Links
  #2  
Old 05-31-2006, 08:32 AM
Scottyk537 Scottyk537 is offline
Registered User
 
Join Date: May 2006
Posts: 49
Scottyk537 is on a distinguished road
I got it!!!!!!!

Play around long enough and your bound to get it.
Here's what I did. Union query:

SELECT Rollnmbr as RN, AG_B_R1 as Num FROM dbo_ADC_Ag_B_Res
UNION ALL
SELECT Rollnmbr, AG_B_R2 FROM dbo_ADC_Ag_B_Res
UNION ALL
SELECT Rollnmbr, AG_B_R3 FROM dbo_ADC_Ag_B_Res
UNION ALL
SELECT Rollnmbr, AG_B_R4 FROM dbo_ADC_Ag_B_Res
UNION ALL
SELECT Rollnmbr, AG_m_R1 FROM dbo_ADC_Ag_m_Res
UNION ALL
SELECT Rollnmbr, AG_m_R2 FROM dbo_ADC_Ag_m_Res
UNION ALL
SELECT Rollnmbr, AG_m_R3 FROM dbo_ADC_Ag_m_Res
UNION ALL
SELECT Rollnmbr, AG_m_R4 FROM dbo_ADC_Ag_m_Res
UNION ALL
SELECT Rollnmbr, AG_e_R1 FROM dbo_ADC_Ag_e_Res
UNION ALL
SELECT Rollnmbr, AG_e_R2 FROM dbo_ADC_Ag_e_Res
UNION ALL
SELECT Rollnmbr, AG_e_R3 FROM dbo_ADC_Ag_e_Res
UNION ALL SELECT Rollnmbr, AG_e_R4 FROM dbo_ADC_Ag_e_Res;

Second Query:

SELECT Q_cals_ag_bme_STDEV_Union.RN, StDev(Q_cals_ag_bme_STDEV_Union.Num) AS StDev
FROM Q_cals_ag_bme_STDEV_Union
GROUP BY Q_cals_ag_bme_STDEV_Union.RN;
Reply With Quote
Sponsored Links
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Select Multiple criteria for query on a form WillEllis Forms 1 11-04-2005 02:25 AM
Form input to query criteria steallan Forms 1 11-04-2005 01:14 AM
Form to display specific query results based on user input Zako Forms 2 04-21-2003 09:38 AM
Form Combo Box in Query Criteria Wallace Schrade Queries 5 10-17-2002 06:08 AM
Specifiy query criteria using a form mark-charlwood Forms 2 03-21-2002 07:40 PM


All times are GMT -8. The time now is 08:34 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
(c) copyright 2009 Access World