MakeTable query will run from Navigation browser but not from code

Skip Bisconer

Who Me?
Local time
Today, 13:21
Joined
Jan 22, 2008
Messages
285
I have this function to run several Maketable queries after another table has been updated but when I try to run them from code during the delete it errors out 2387 indicating the tables cannot be deleted as they are participating in one or more relationships. However they run perfectly from the Navagation pane.

Code:
Function UpdateAllTrainingPolicyTbls()
'Update from Add New Training Policy to Positions Table
On Error GoTo ErrorHandler
DoCmd.SetWarnings False
DoCmd.OpenQuery "TrainingReqUpdateToDriver"
DoCmd.OpenQuery "TrainingReqUpdateToFiller"
DoCmd.OpenQuery "TrainingReqUpdateToHandler"
DoCmd.OpenQuery "TrainingReqUpdateToManagement"
DoCmd.OpenQuery "TrainingReqUpdateToOffice"
DoCmd.OpenQuery "TrainingReqUpdateToSales"
DoCmd.SetWarnings True
Exit Function
ErrorHandler:
    ' Display error information.
    MsgBox "Error number " & Err.Number & ": " & Err.Description
    ' Resume with statement following occurrence of error.
    Resume Next
End Function
 

Users who are viewing this thread

Back
Top Bottom