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