Thanks, that seemed to work so far. I haven't tested thoroughly though. This brings up another problem though. Like stated before, I have code that exports the query to excel. The code for that is:
DoCmd.OutputTo acOutputQuery, "Exported charges", "Excel97-Excel2003Workbook(*.xls)", ""...