G
GLT
Hi,
I have a form that is bound to a query. The form displays a list of servers
and a count of errors that have occured on each server.
I also have two buttons on my form, one which is labelled 'All' and the
other is labelled 'Errors Only'.
I have modified the query (via the QBE grid) to allow for both situations,
and copied the SQL as follows:
When I click the 'All' button, I would like the following SQL to run:
SELECT Full_Compare_Q.BTSContactGroup, Full_Compare_Q.Server,
Full_Compare_Q.RecID, Abs(Sum(Services.Valid)) AS ErrorCount,
IIf([Ping]=-1,"OK","FAIL") AS PingRslt
FROM Full_Compare_Q LEFT JOIN Services ON Full_Compare_Q.RecID =
Services.RecID
GROUP BY Full_Compare_Q.BTSContactGroup, Full_Compare_Q.Server,
Full_Compare_Q.RecID, IIf([Ping]=-1,"OK","FAIL")
ORDER BY Full_Compare_Q.BTSContactGroup, Full_Compare_Q.Server;
When I click the 'Errors Only' button, I would like the following SQL to run:
SELECT Full_Compare_Q.BTSContactGroup, Full_Compare_Q.Server,
Full_Compare_Q.RecID, Abs(Sum(Services.Valid)) AS ErrorCount,
IIf([Ping]=-1,"OK","FAIL") AS PingRslt
FROM Full_Compare_Q LEFT JOIN Services ON Full_Compare_Q.RecID =
Services.RecID
GROUP BY Full_Compare_Q.BTSContactGroup, Full_Compare_Q.Server,
Full_Compare_Q.RecID, IIf([Ping]=-1,"OK","FAIL")
HAVING (((Abs(Sum([Services].[Valid])))>1)) OR
(((IIf([Ping]=-1,"OK","FAIL")) Like "FAIL"))
ORDER BY Full_Compare_Q.BTSContactGroup, Full_Compare_Q.Server;
These two lots of SQL work fine, I just want to be able to change the Query
parameters when either button is clicked. Can anyone advise how to do this?
Any help is always greatly appreciated...
Cheers,
GLT.
I have a form that is bound to a query. The form displays a list of servers
and a count of errors that have occured on each server.
I also have two buttons on my form, one which is labelled 'All' and the
other is labelled 'Errors Only'.
I have modified the query (via the QBE grid) to allow for both situations,
and copied the SQL as follows:
When I click the 'All' button, I would like the following SQL to run:
SELECT Full_Compare_Q.BTSContactGroup, Full_Compare_Q.Server,
Full_Compare_Q.RecID, Abs(Sum(Services.Valid)) AS ErrorCount,
IIf([Ping]=-1,"OK","FAIL") AS PingRslt
FROM Full_Compare_Q LEFT JOIN Services ON Full_Compare_Q.RecID =
Services.RecID
GROUP BY Full_Compare_Q.BTSContactGroup, Full_Compare_Q.Server,
Full_Compare_Q.RecID, IIf([Ping]=-1,"OK","FAIL")
ORDER BY Full_Compare_Q.BTSContactGroup, Full_Compare_Q.Server;
When I click the 'Errors Only' button, I would like the following SQL to run:
SELECT Full_Compare_Q.BTSContactGroup, Full_Compare_Q.Server,
Full_Compare_Q.RecID, Abs(Sum(Services.Valid)) AS ErrorCount,
IIf([Ping]=-1,"OK","FAIL") AS PingRslt
FROM Full_Compare_Q LEFT JOIN Services ON Full_Compare_Q.RecID =
Services.RecID
GROUP BY Full_Compare_Q.BTSContactGroup, Full_Compare_Q.Server,
Full_Compare_Q.RecID, IIf([Ping]=-1,"OK","FAIL")
HAVING (((Abs(Sum([Services].[Valid])))>1)) OR
(((IIf([Ping]=-1,"OK","FAIL")) Like "FAIL"))
ORDER BY Full_Compare_Q.BTSContactGroup, Full_Compare_Q.Server;
These two lots of SQL work fine, I just want to be able to change the Query
parameters when either button is clicked. Can anyone advise how to do this?
Any help is always greatly appreciated...
Cheers,
GLT.