I commented out lines in the codebuilder one by one to determine which were and weren't working, see comments in brackets below:
I can run the append queries manually and they all work fine. The column references in the code are also matched correctly to the columns in the listbox.
So I guess you can't use CurrentDB.Execute to run append queries?
Thank you for any ideas of what may be wrong. Always appreciated.
Code:
Private Sub ReportButton_Click()
Dim varItem As Variant
For Each varItem In Me.ReportList.ItemsSelected
CurrentDb.Execute Me.ReportList.Column(2, varItem) <This runs a delete query and works.>
CurrentDb.Execute Me.ReportList.Column(3, varItem) <This also runs a delete query and works.>
CurrentDb.Execute Me.ReportList.Column(4, varItem) <This runs an append query and DOES NOT work; its highlighted in the code builder>
CurrentDb.Execute Me.ReportList.Column(5, varItem) <This also runs an append query and DOES NOT work; its highlighted in the code builder>
DoCmd.OpenReport Me.ReportList.Column(6, varItem), acViewReport <This opens a report and works.>
Next varItem
End Sub
So I guess you can't use CurrentDB.Execute to run append queries?
Thank you for any ideas of what may be wrong. Always appreciated.