Probably not the most straightforward or well designed code, but could someone please help me fix this?
The database keeps giving the message "Docmd.output to is not avaliable now", and then shuts down. The problem only happens however when the database window is hidden - not that should make much difference.
Private Sub Cmd_ExportAll_Click()
DBLocation = Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name)))
On Error GoTo Err_Cmd_ExportAll_Click
DoCmd.Echo False, "Course Evaluations Reports are currently being exported"
MyGloTrainingCourse = Me.Val_TrainingCourse.Value
MyGloFromDate = Me.Val_FromDate.Value
MyGloToDate = Me.Val_ToDate.Value
MyGloCategory = Me.Val_Category.Value
MyGloSection1 = True
'These Global values are values that are needed in the report
MyDimListTrainerCount = Me.Val_Trainer.ListCount
MyDimListTrainerIndex = 0
If MsgBox(("This will export " & [MyDimListTrainerCount] & " record(s) to the location " & DBLocation & ", Are you sure you wish to continue?"), vbYesNo, "Warning!") = vbNo Then
Do Until MyDimListTrainerIndex = MyDimListTrainerCount