Thread: SQL to VBA ??
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Tammy Tammy is offline
external usenet poster
 
Posts: 145
Default SQL to VBA ??

I have these 3 queries in ACCESS but I'd like to be able to do the same thing
in EXCEL.

Can anybody translate these three queries to something I can use in EXCEL?

Query Tammy1
SELECT Jan14.RTC, Jan14.AirportCode, Jan14.Date, IIf([Type]="Independent
Contractor",[ServiceOrders],0) AS ContractorServiceOrders,
IIf([Type]="Agent",[ServiceOrders],0) AS IndependentAgentServiceOrders,
Jan14.ServiceOrders
FROM Jan14;

Query Tammy2
SELECT Tammy_1.RTC, Tammy_1.Date, Tammy_1.AirportCode,
Count(Tammy_1.AirportCode) AS CountOfAirportcode,
Sum(Tammy_1.ContractorServiceOrders) AS SumOfContractorServiceOrders,
Sum(Tammy_1.IndependentAgentServiceOrders) AS
SumOfIndependentAgentServiceOrders, Sum(Tammy_1.ServiceOrders) AS
SumOfServiceOrders
FROM Tammy_1
GROUP BY Tammy_1.RTC, Tammy_1.Date, Tammy_1.AirportCode
HAVING (((Tammy_1.RTC)="dfw"));

Query Tammy3

SELECT Tammy_2.Date, Tammy_2.AirportCode,
Tammy_2.SumOfContractorServiceOrders AS IC,
Tammy_2.SumOfIndependentAgentServiceOrders AS Agent,
Tammy_2.SumOfServiceOrders AS ServiceOrders,
([SumOfContractorServiceOrders]/[SumOfServiceOrders]) AS PercentICUtilization
FROM Tammy_2;