Advertisement
Advertisement
| 04.10.2008 at 01:49PM PDT, ID: 23313322 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: |
Private Sub cmdZoneformat_Click()
Dim rst As DAO.Recordset
Dim flags As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("SELECT DISTINCT Zone FROM [LCT and Zones]")
Set flags = CurrentDb.OpenRecordset("Flags")
rst.MoveFirst
flags.MoveFirst
Do While Not rst.EOF
'First remove existing MIBIS Web Site Details spreadsheet
Call DeleteFile(CurrentProject.path & "\Web\" & rst!Zone & ".xls")
'Reset the SQL statement with Zone proceeded
MsgBox rst!Zone & " file has been deleted"
CurrentDb.QueryDefs("MyMetricsDetails").SQL = "SELECT qry_MIBIS_Metrics_Details.*, " & _
"qryMonthlyCumulativeCost.[Monthly Cumulated Cost], qryQuarterlyCumulativeCost.[Quarterly Cumulated Cost], " & _
"qryYearlyCumulativeCost.[Yearly Cumulated Cost] FROM ((qry_MIBIS_Metrics_Details LEFT JOIN " & _
"qryYearlyCumulativeCost ON qry_MIBIS_Metrics_Details.[Cryo Id] = qryYearlyCumulativeCost.[Cryo id]) " & _
"LEFT JOIN qryQuarterlyCumulativeCost ON qry_MIBIS_Metrics_Details.[Cryo Id] = qryQuarterlyCumulativeCost.[Cryo id]) " & _
"LEFT JOIN qryMonthlyCumulativeCost ON qry_MIBIS_Metrics_Details.[Cryo Id] = qryMonthlyCumulativeCost.[Cryo id]" & _
"WHERE ([qry_MIBIS_Metrics_Details]![Zone]= '" & rst!Zone & "')"
MsgBox "Dumped data into MyMetricsDetails"
'Exports pass-through table
MsgBox CurrentProject.path
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "MyMetricsDetails", CurrentProject.path & "\Web\" & rst!Zone & ".xls", , rst!Zone
MsgBox "Exported file " & rst!Zone
|