VB Code:
Private Sub MakeFile(CalledThis)
'This sub is called to create an mdb file to store the data in.
Dim AccessApp As Access.Application
On Error GoTo SameName
Set AccessApp = New Access.Application
With AccessApp
.NewCurrentDatabase CalledThis
End With
GoTo SkipThis
SameName:
If Err.Number = 7865 Then
MsgBox "ALERT: There is already a file with the name: " & vbCrLf & """" & CalledThis & """" & vbCrLf & "and the system is trying to use it." & vbCrLf & vbCrLf & "If this file is important please move it now.", vbCritical, "Name error"
End If
SkipThis:
End Sub