Hello,
I'm Trying to cobble together a solution at my office using SharePoint and Office 2010.
The setup involves doing some datapulls from SharePoint to Access and then pushing some
of those results to Excel for calculations\formatting based on 2 (dynamic) variables.
I have the data successfully auto-flowing from SharePoint to Access.
I have some parameterized queries that are sitting on top of the "SharePoint
tables" in Access and those queries prompt for 2 variables. Org and Calendar Year [CY] (same spelling/capitalization in both queries). Standalone, the queries execute fine.
Using VBA, I created a form with a button. Behind that button is the following code.
Private Sub Command0_Click()
strPath= "C:\Users\DC24955\Desktop\Export Test.xlsx"
Dim qdf As DAO.QueryDef
Dim qdf1 As DAO.QueryDef
Dim dbs As DAO.Database
Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("Qry_IPP_Develop_and_Doc_Perf_Stnds")
Set qdf1 = dbs.QueryDefs("Qry_IPP_New_Employees")
qdf.Close
qdf1.Close
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "Qry_IPP_Develop_and_Doc_Perf_Stnds", strPath, True, "IPP_Dev_and_Doc_Perf_Stnds"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "Qry_IPP_New_Employees", strPath, True, IPP_New_Emp"
End
Sub
After several days, I was able to work out the bugs so that when I click the form button, the code executes correctly and the queries populate excel... with the right results… My only complaint
is that even though both queries have parameters with the same name, I get 2 sets of prompts.
Is there any way (with minimal coding changes), to have the prompts come up only 1 time and have the values provided in the first prompt, passed along as variables to the subsequent queries?
By the time I am done, I will be executing over 12 different saved queries. All of them will be driven by Org and CY and so it would be great is there was a simple work-around to retain
those values and pass them to the prompt.
Thank you