Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does Access 2007 have something like a serverversion

Status
Not open for further replies.

Wolfen12

Programmer
Jul 17, 2007
19
NL
Im trying to open a connection, but it fails, because my OleDbConnection state is closed, and the reason it is closed, because the OleDbConnection.serverversion breaks with:

ServerVersion = 'clsobjConnectionMDB.ServerVersion' threw an exception of type 'System.InvalidOperationException'
 
If you're using an ADO provider you can evaluate the properties of your connection object thus:

Code:
Function test()
    Const connect = "Provider=SQLOLEDB;Server=(local);User ID=userid;Password=pwd;Initial Catalog=Northwind;Network Library=dbmssocn;App=My App"
    
    Dim i As Integer
    
    Dim cn As ADODB.Connection
    
    Set cn = New ADODB.Connection
    With cn
        .ConnectionString = connect
        .CursorLocation = adUseClient
        .Open
    End With
        
    For i = 0 To cn.Properties.Count - 1
        Debug.Print cn.Properties(i).Name & ": " & cn.Properties(i).Value
    Next i
    cn.Close
    Set cn = Nothing
End Function

The exact property you need will be shown in the list, along with the value with the current connection.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top