Code to open Recordset as Snapshot


Sub NewDatabaseCode()

   Dim wrkMain As Workspace
   Dim conPubs As Connection
   Dim dbsPubs As Database
   Dim prpLoop As Property
   Dim rs As Recordset

   ' Create ODBCDirect Workspace object instead of Microsoft
   ' Jet Workspace object.
   Set wrkMain = CreateWorkspace("", "admin", "", dbUseODBC)

   ' Open Connection object based on information in
   ' the connect string.
   ' Note: The DSN referenced below must be configured to
   '       use Microsoft Windows NT Authentication Mode to
   '       authorize user access to the Microsoft SQL Server.
    Set conPubs = wrkMain.OpenConnection("Northwind", _
        dbDriverNoPrompt, False, _
        "ODBC;DATABASE=Northwind;DSN=Nwind")
   ' Assign the Database property to the same object
   ' variable as in the old code.
   Set dbsPubs = conPubs.Database

    ' Open Recordset of Employees table as Snapshot
    Set rs = dbsPubs.OpenRecordset("Employees", dbOpenSnapshot)
    Do While rs.EOF = False
        Debug.Print rs.Fields(0).Name, rs.Fields(0).Value
        rs.MoveNext
    Loop
    
    
    rs.Close
   dbsPubs.Close
   wrkMain.Close

End Sub




Regards, 
Mark 





To: [email protected]
From: [EMAIL PROTECTED]
Date: Wed, 24 Sep 2008 21:11:01 +0000
Subject: [Access VBA Central] Open a SNAPSHOT file using VBA?



















    
            Hi!



How do I open a SNAPSHOT file using VBA? 



Thanks! 



Dennick



P.S. - I'm using Access 2003 & Win XP




      

    
    
        
        
        
        


        


        
        
        
        
        



[Non-text portions of this message have been removed]

Reply via email to