I am trying to export my Access Database Data into an Excel file and then clear the data

I have been able to get this to work on my PC locally with the MDW file attached

but when I attach the MDW file for our security I get a permissions error

I imagine that when I use the Set command to open the database it is looking for the user id and password but I do not know how to code this

any help with this would be appriciated

thanks

Private Sub Command10_Click()
On Error GoTo err_command10

Dim strExcelFile As String
Dim strWorksheet As String
Dim strDB As String
Dim strTable As String
Dim objDB As Database
Dim RESULT As Integer
Dim STRSQL As String
Dim RecordDate As Date

RESULT = MsgBox("THIS ACTION WILL EXPORT TRAINING TABLE DATA TO EXCEL FILE AND THEN DELETLE THE DATA FROM TABLE, ARE YOU SURE YOU WANT TO COMPLETE THIS ACTION", vbQuestion + vbYesNo, "DELETE")
If RESULT = vbYes Then
RecordDate = DateSerial(Year(Date) - 1, Month(Date), Day(Date))
strExcelFile = "s:\OSHA\CosmoflexTraining" & RecordDate & ".xls"
strWorksheet = "WorkSheet1"
strDB = "s:\osha\trainingdb\cosmoflextraining.mdb"
strTable = "Training"
Set objDB = OpenDatabase(strDB)
objDB.Execute _


"SELECT * INTO [Excel 8.0;DATABASE=" & strExcelFile & _
"].[" & strWorksheet & "] FROM " & "[" & strTable & "]"
objDB.Close
Set objDB = Nothing
STRSQL = "UPDATE training SET hazcom = NULL,hazcomdate = NULL,HEARING = NULL,HEARINGDATE = NULL,PPE = NULL,PPEDATE = NULL,LOTO = NULL,LOTODATE = NULL,FIRESAFETY = NULL,FIRESAFEDATE = NULL,BLOODBORNE = NULL,BLOODBORNEDATE = NULL,FORKLIFT = NULL,FORKLIFTDATE = NULL"
DoCmd.SetWarnings WARNINGOFF
DoCmd.RunSQL STRSQL
MsgBox "TRAINGIN TABLE DATA HAS BEEN DELETED", vbInformation, "MESSAGE"
DoCmd.SetWarnings WARNINGSON
End If
exit_command10:
Exit Sub
err_command10:
MsgBox "A MS ACCESS ERROR HAS OCCURED" & vbCrLf & "Please Contact System Administrator" & vbCrLf & vbCrLf & Err.Description, vbCritical, "ERROR !!!"
Resume exit_command10

End Sub