function testlockmode() if instr(currentproject.connection.connectionstring, "jet oledb:database locking mode=0") > 0 then msgbox "本數據庫已經用獨占方式打開" else msgbox "本數據庫未用獨占方式打開" end if end function
function testlockmode() on error resume next dim conn as new adodb.connection conn.open "provider=microsoft.jet.oledb.4.0;user id=admin;data source=l:/ibm winxp/desktop/mdb/重復記錄.mdb;jet oledb:database locking mode=0;" if err.number = -2147467259 then msgbox "文件已經在使用中,估計是被別人以獨占方式打開了" end if end function