Sign in to follow this  
Followers 0
MDziubek

MSAccess 2003-2010 Who is Online

1 post in this topic

Based on: http://support.microsoft.com/kb/198755/EN-US

Works with mdb and accdb file:

Local $var = FileOpenDialog("Choose DB File", @WorkingDir & "\", "Access 2000-2003 (*.mdb)|Access 2007 (*.accdb)", 1 + 4)
If not @error Then
    $var = StringReplace($var, "|", @CRLF)
    $cn =  ObjCreate("ADODB.Connection")
    If StringRight($var,3)="mdb" Then
        $cn.Provider = "Microsoft.Jet.OLEDB.4.0"
    Else
        $cn.Provider = "Microsoft.ACE.OLEDB.12.0"
    EndIf
    $cn.Open($var)
    $rs = $cn.OpenSchema(-1,Default,"{947bb102-5d43-11d1-bdbf-00c04fb92675}")
    $file=FileOpen(@ScriptDir & "\WhoOnLine.txt", 2)
    FileWriteLine($file,"Users in:" & $var)
    FileWriteLine($file,"-----------------------------------------------------------------------")
    FileWriteLine($file,$rs.Fields(0).Name & @TAB & $rs.Fields(1).Name & @TAB & $rs.Fields(2).Name & @TAB & $rs.Fields(3).Name)
    While Not $rs.EOF
        FileWrite($file,$rs.Fields(0).value & @TAB)
        FileWrite($file,$rs.Fields(1).value & @TAB)
        FileWrite($file,$rs.Fields(2).value & @TAB)
        FileWrite($file,$rs.Fields(3).value)
        FileWrite($file,@CRLF)
        $rs.MoveNext
    Wend
    FileClose($file)
    run("notepad.exe """ & @ScriptDir & "\WhoOnLine.txt")
    $rs.close
    $cn.close
EndIf

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0