Hi All,
I have some code that runs a query from a form Command Button. One the form are 2 unbound fields that get data from a another query. How can I use the data in the 2 unbound fields in my code. The 2 unbound fields are [date1] and [date2].
CODE:
DoCmd.OutputTo acOutputQuery, "NDTMS_ReturnQueryTEMP", acFormatXLS, "F:\Ley_Community\Database\NDTMS_Reports\NDTMS.xls", False
Dim xlApp As Excel.Application, xlSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application")
xlApp.Application.Visible = False
xlApp.Workbooks.Open "F:\Ley_Community\Database\NDTMS_Reports\NDTMS.xls"
Set xlSheet = xlApp.ActiveSheet
' Below, you need to add the code to do whatever is required in the Excel sheet
'Range("B2").Select
'ActiveWorkbook.save
' Delete the above 2 lines when you have added your code
xlApp.Application.Visible = True
'Clean up here
Set xlSheet = Nothing
Set xlApp = Nothing
End
I have played with this all day with no luck, any help would be good.
Kind Regards,
Dereck.
I have some code that runs a query from a form Command Button. One the form are 2 unbound fields that get data from a another query. How can I use the data in the 2 unbound fields in my code. The 2 unbound fields are [date1] and [date2].
CODE:
DoCmd.OutputTo acOutputQuery, "NDTMS_ReturnQueryTEMP", acFormatXLS, "F:\Ley_Community\Database\NDTMS_Reports\NDTMS.xls", False
Dim xlApp As Excel.Application, xlSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application")
xlApp.Application.Visible = False
xlApp.Workbooks.Open "F:\Ley_Community\Database\NDTMS_Reports\NDTMS.xls"
Set xlSheet = xlApp.ActiveSheet
' Below, you need to add the code to do whatever is required in the Excel sheet
'Range("B2").Select
'ActiveWorkbook.save
' Delete the above 2 lines when you have added your code
xlApp.Application.Visible = True
'Clean up here
Set xlSheet = Nothing
Set xlApp = Nothing
End
I have played with this all day with no luck, any help would be good.
Kind Regards,
Dereck.