Brott
Board Regular
- Joined
- Dec 12, 2002
- Messages
- 110
This is a long read, thanks for you time in advance.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
Before I begin here is some background. I currently have an Excel file with the ODBC connection and using my own SQL. Doing it this way would require the super user to go into each sheet then to the SQL each time to change the dates. I know there is a way to allow them to simply change the dates in cells H1 (or H1 and H2) then refresh data and whoolaa it would be updated.<o></o>
<o></o>
My goal if possible via this board and all the knowledge available would be to have a spreadsheet allowing a super user to change the date in Cells H1 and H1 & H2 on sheet Tst1 and have the data returned to sheets (Tst2, Tst3) based on my own SQL statements. <o></o>
<o></o>
Here are some parameters that I think you might need to know. <o></o>
(And as you may guess I do not have much VBA experience so if at all possible use my naming convention shown below. and feel free to write for a first grader.)<o></o>
<o></o>
User Name (not actual): "UID"<o></o>
Server (not actual): "DEV"<o></o>
Password (not actual): "PWD"<o></o>
File Name: Excel_ODBC.xls<o></o>
Sheet Name: "Tst2"<o></o>
"Tst3"<o></o>
Output Cell: "A1" for both sheets.<o></o>
Oracle table name: UAB <o></o>
Current Sql scripts (one for each sheet): <o></o>
Sql for sheet "Tst2"<o></o>
SELECT A.UAB_USER_ID_AUTHOR "Clerk", <o></o>
SUM(A.UAB_TOTAL_AMT)"Total Amount",<o></o>
COUNT(*)"Total Number of PAs"<o></o>
FROMUAB A<o></o>
WHERE TRUNC (A.UAB_DATE_CREATED)= TO_DATE ('02/26/2008','MM/DD/YYYY') <o></o>
GROUPBY A.UAB_USER_ID_AUTHOR;<o></o>
Sql for sheet "Tst3"<o></o>
SELECT A.UAB_USER_ID_AUTHOR "Clerk", <o></o>
SUM(A.UAB_TOTAL_AMT)"Total Amount",<o></o>
COUNT(*)"Total Number of PAs"<o></o>
FROMUAB A<o></o>
WHERE TRUNC (A.UAB_DATE_CREATED)>= TO_DATE ('01/01/2008','MM/DD/YYYY')AND<o></o>
TRUNC (A.UAB_DATE_CREATED)<= TO_DATE ('01/31/2008','MM/DD/YYYY') <o></o>
GROUPBY A.UAB_USER_ID_AUTHOR;<o></o>
<o></o>
At this point that is all I can think of. If it would be best served having this in two separate files for each SQL statement that would not be that bad but I would need to know how to handle a single date then the two date ranges. I do appreciate your assistance in helping me with this as I am sure this is very common task. Whewww the end.
Before I begin here is some background. I currently have an Excel file with the ODBC connection and using my own SQL. Doing it this way would require the super user to go into each sheet then to the SQL each time to change the dates. I know there is a way to allow them to simply change the dates in cells H1 (or H1 and H2) then refresh data and whoolaa it would be updated.<o></o>
<o></o>
My goal if possible via this board and all the knowledge available would be to have a spreadsheet allowing a super user to change the date in Cells H1 and H1 & H2 on sheet Tst1 and have the data returned to sheets (Tst2, Tst3) based on my own SQL statements. <o></o>
<o></o>
Here are some parameters that I think you might need to know. <o></o>
(And as you may guess I do not have much VBA experience so if at all possible use my naming convention shown below. and feel free to write for a first grader.)<o></o>
<o></o>
User Name (not actual): "UID"<o></o>
Server (not actual): "DEV"<o></o>
Password (not actual): "PWD"<o></o>
File Name: Excel_ODBC.xls<o></o>
Sheet Name: "Tst2"<o></o>
"Tst3"<o></o>
Output Cell: "A1" for both sheets.<o></o>
Oracle table name: UAB <o></o>
Current Sql scripts (one for each sheet): <o></o>
Sql for sheet "Tst2"<o></o>
SELECT A.UAB_USER_ID_AUTHOR "Clerk", <o></o>
SUM(A.UAB_TOTAL_AMT)"Total Amount",<o></o>
COUNT(*)"Total Number of PAs"<o></o>
FROMUAB A<o></o>
WHERE TRUNC (A.UAB_DATE_CREATED)= TO_DATE ('02/26/2008','MM/DD/YYYY') <o></o>
GROUPBY A.UAB_USER_ID_AUTHOR;<o></o>
Sql for sheet "Tst3"<o></o>
SELECT A.UAB_USER_ID_AUTHOR "Clerk", <o></o>
SUM(A.UAB_TOTAL_AMT)"Total Amount",<o></o>
COUNT(*)"Total Number of PAs"<o></o>
FROMUAB A<o></o>
WHERE TRUNC (A.UAB_DATE_CREATED)>= TO_DATE ('01/01/2008','MM/DD/YYYY')AND<o></o>
TRUNC (A.UAB_DATE_CREATED)<= TO_DATE ('01/31/2008','MM/DD/YYYY') <o></o>
GROUPBY A.UAB_USER_ID_AUTHOR;<o></o>
<o></o>
At this point that is all I can think of. If it would be best served having this in two separate files for each SQL statement that would not be that bad but I would need to know how to handle a single date then the two date ranges. I do appreciate your assistance in helping me with this as I am sure this is very common task. Whewww the end.