G
Guest
Hi,
I have never worked with Arrays and I need some help. I found some
suggestions from other posted questions and I am trying to make their code
work for what I am trying to do.
I have a Site table with 205 records - one record for each of our sites
(multiple fields each record). Supervisors are each responsible for multiple
sites. For each Supervisor, I would like to export their site(s) information
to separate tabs in an Excel workbook where they will add current month's
metric data. Once the Supervisors have updated the workbook, I will need to
upload the Metrics into the database. Is the best way to accomplish this?
So far, I cannot compile my code as it keeps telling me that 'Method or Data
Member not found' and highlights the line with (vSupID = rst.SupId). SupId
is a text field and is the PK in tblSupervisor.
Please Help! Any advice would be greatly appreciated.
My code is below.
Arlene
Option Compare Database
Option Explicit
Public vSupID As String
Public Sub Export_Metrics()
Dim rst As DAO.Recordset
Dim vWorkbook As String
Dim vPath As String
Dim vFileName As String
vFileName = Format(Date, "mmmm_yyyy") & "_Metrics.xls"
vPath = "\\chcwp03fs\fo_common$\Database\Metrics\"
vWorkbook = vPath & vFileName
Set rst = CurrentDb.OpenRecordset("tblSupervisor", dbOpenDynaset)
Do Until rst.EOF
vSupID = rst.SupId
Debug.Print SupId
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
qryExportMetrics, vWorkbook, , vSupID
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub
Public Function Selected_SupId()
Selected_SupId = vSupID
End Function
I have never worked with Arrays and I need some help. I found some
suggestions from other posted questions and I am trying to make their code
work for what I am trying to do.
I have a Site table with 205 records - one record for each of our sites
(multiple fields each record). Supervisors are each responsible for multiple
sites. For each Supervisor, I would like to export their site(s) information
to separate tabs in an Excel workbook where they will add current month's
metric data. Once the Supervisors have updated the workbook, I will need to
upload the Metrics into the database. Is the best way to accomplish this?
So far, I cannot compile my code as it keeps telling me that 'Method or Data
Member not found' and highlights the line with (vSupID = rst.SupId). SupId
is a text field and is the PK in tblSupervisor.
Please Help! Any advice would be greatly appreciated.
My code is below.
Arlene
Option Compare Database
Option Explicit
Public vSupID As String
Public Sub Export_Metrics()
Dim rst As DAO.Recordset
Dim vWorkbook As String
Dim vPath As String
Dim vFileName As String
vFileName = Format(Date, "mmmm_yyyy") & "_Metrics.xls"
vPath = "\\chcwp03fs\fo_common$\Database\Metrics\"
vWorkbook = vPath & vFileName
Set rst = CurrentDb.OpenRecordset("tblSupervisor", dbOpenDynaset)
Do Until rst.EOF
vSupID = rst.SupId
Debug.Print SupId
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
qryExportMetrics, vWorkbook, , vSupID
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub
Public Function Selected_SupId()
Selected_SupId = vSupID
End Function