Hi CJ,
I have been playing about with the code and it's recognising it's there however every time I test it the message comes up. Even though i have put it on the BeforeUpdate event the job still updates and the message appears saying that the drive could not be reached.
I had to amend the code as the word DriveIsAvailable it did not like so i just changed that to Drive.
I now have a module called 'CheckServer' and the code is as follows...
Code:
Function Drive(MDrive As String) As Boolean
On Error Resume Next
ChDir MDrive & "C:\Users\lock01k\OneDrive - UK Power Networks\Desktop\Database test with Adam"
Drive = Err = 0
End Function
Then in the BeforeUpdate event linked tot he form i have the following code...
Code:
If Drive("C:\Users\lock01k\OneDrive - UK Power Networks\Desktop\Database test with Adam") Then
'carry on
Else
MsgBox "Drive not available, there may be a temporary network failure so please try again later. If the problem persists please contact your IT dept", vbOKOnly
End If
I am probably doing something completely wrong but at the moment it's letting me make a change and go to the next line and it's not stopping the update however the message "Drive not available, there may be a temporary network failure so please try again later. If the problem persists please contact your IT dept" is then showing up.