BamaColtsFan
Registered User.
- Local time
- Today, 09:22
- Joined
- Nov 8, 2006
- Messages
- 91
I'm having a little trouble getting started with my Do Until loop. I think I understand the structure I need to use except that I'm not really sure how to get the loop to execute my query using the values from the control list as variables. Basically, I want the loop to execute the query and return only those records belonging to the specified department for each run of the loop. What I think I'm missing is how do I pass the value for department into the query so the loop knows what to do with it? Below is what I have so far, but I'm sure I'm way off. Please offer any tricks that jump to mind...
Code:
Public Function CopyToWorkbook()
Dim db As DAO.Database
Dim newPath As DAO.Recordset
Dim strPath As String
Set db = CurrentDb()
Set newPath = db.OpenRecordset("Set_Path")
Set DeptList = db.OpenRecordset("qryDepartmentList")
strPath = newPath!path & "CombinedTimecards_Crosstab.xlsx"
Do Until DeptList.EOF
DoCmd.TransferSpreadsheet acExport, 8, "qryDelinquentList", "strPath", True, "Delinquent_List"
Loop
End Function