Code error in export

P

Peter

Hi all

i am getting an error code when running this command

(sql = Me.Daily_log.RowSource)..seems me daily log is wrong?


Private Sub Export_to_Excel_Click()
'export current data in MainList to Excel
'uses whatever columns you have in the MainList listbox
'Note: you can use the excel export on the detail screen to get all columns
On Error GoTo Err_cmdExportToExcel

Dim sql As String
Dim filepath As String

sql = Me.Daily_log.RowSource
filepath = CurrentDBDir() & Me.lblHeading.Caption & "_Export.xls"
Call ExportQueryToExcel("qryExport", sql, filepath)

Exit_cmdExportToExcel:
Exit Sub

Err_cmdExportToExcel:
MsgBox Err.Description
Resume Exit_cmdExportToExcel

Thanks!
 
K

Ken Snell MVP

If you've named a control "daily log", then VBA will name it "daily_log" in
code because a space is not allowed in VBA names.

What error are you getting with that step?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top