Hi guyz I have created a project that 2 or more computers can access my excel database.. now my problem is I tried 2 computer saving data at the same time to my database, 1 of the computer will successfully save but the other 1 appearing Password Prompt. so far here's my code... maybe anyone of you can help me about this
i = 0
bFound = False
While i < 20
If FileInUse(DBLoc & NewFileName) Then
'If IsFileOpen(DBLoc & NewFileName) = True Then
Application.Wait (Now + TimeValue("0:00:01"))
i = i + 1
bFound = False
Else
i = 20
bFound = True
'Exit Sub
End If
Wend
If bFound = True Then
Application.ScreenUpdating = True
Application.EnableEvents = True
Application.DisplayAlerts = True
Else
msg = MsgBox("Cannot Proceed to Task! Database already opened by " & GetFileOwner(DBLoc & NewFileName) & ".", vbOKOnly + vbExclamation, "ERTS Guide!")
Application.ScreenUpdating = True
Application.EnableEvents = True
Application.DisplayAlerts = True
Exit Sub
End If
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.DisplayAlerts = False
Set src = Workbooks.Open(DBLoc & NewFileName, Password:="2177", WriteResPassword:="2177", ReadOnly:=False)
src.Worksheets("Done").Unprotect Password:="2177"
Application.AskToUpdateLinks = True