J
Jen
Hi,
I am currently working on an export to excel that should go to multiple tabs
- named after the branches on the query. The problem is that while debugging,
it comes up with an error stating that rst.BranchName does not exist. I have
double checked the spelling on the field in the query being used as the
recordset & it is correct. It is not a primary key, but there are only 6 and
each is unique ... what did I do wrong?
Here is the VB that I altered from a previous post here:
Option Compare Database
Public vHelpline As String
Sub Export_Helpline()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim vWorkbook As String
vWorkbook = "N:\ADMIN\Jennifer SM\Helpline Info\Helpline Report.xls"
Set db = CurrentDb
Set rst = db.OpenRecordset("qryBranchesGrouped")
Do Until rst.EOF
vHelpline = rst.BranchName
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
qryHelplineCallsAllByWeek_Crosstab, vWorkbook, , vHelpline
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub
Function Selected_Helpline()
Selected_Helpline = vHelpline
End Function
Thank you!
I am currently working on an export to excel that should go to multiple tabs
- named after the branches on the query. The problem is that while debugging,
it comes up with an error stating that rst.BranchName does not exist. I have
double checked the spelling on the field in the query being used as the
recordset & it is correct. It is not a primary key, but there are only 6 and
each is unique ... what did I do wrong?
Here is the VB that I altered from a previous post here:
Option Compare Database
Public vHelpline As String
Sub Export_Helpline()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim vWorkbook As String
vWorkbook = "N:\ADMIN\Jennifer SM\Helpline Info\Helpline Report.xls"
Set db = CurrentDb
Set rst = db.OpenRecordset("qryBranchesGrouped")
Do Until rst.EOF
vHelpline = rst.BranchName
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
qryHelplineCallsAllByWeek_Crosstab, vWorkbook, , vHelpline
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub
Function Selected_Helpline()
Selected_Helpline = vHelpline
End Function
Thank you!