I would use the ShellExecute function to do that.  I have a public
function which I use to open files in external programs.

GENERAL DECLARATIONS:


Option Compare Database
Option Explicit

Public Declare Function GetDesktopWindow Lib "user32" () As Long

Public Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As 
Long
      
Public Declare Function ShellExecute Lib "shell32" Alias "ShellExecuteA" _
    (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
    ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd 
As Long) As Long


Public Const SW_HIDE As Long = 0
Public Const SW_SHOWNORMAL As Long = 1
Public Const SW_SHOWMINIMIZED As Long = 2
Public Const SW_SHOWMAXIMIZED As Long = 3
Public Const SW_SHOWDEFAULT As Long = 10
Public Const SE_ERR_NOASSOC As Long = 31

MODULE:


Public Function RunShellExecute(sFile As Variant, Optional nShowCmd As Long) As 
Long
Dim success As Long
    
    If nShowCmd = 0 Then nShowCmd = SW_SHOWDEFAULT
    
    success = ShellExecute(GetDesktopWindow(), "OPEN", sFile, 0&, 0&, nShowCmd)

    If success = SE_ERR_NOASSOC Then
       Call Shell("rundll32.exe shell32.dll,OpenAs_RunDLL " & sFile, 
vbNormalFocus)
    End If
    
    RunShellExecute = success
End Function

USEAGE:


Dim MyVar as long

    MyVar = RunShellExecute("D:\MyFolder\mysnap.snp")

Hope this helps

WB


----- Original Message ----
From: oc_for_me <[EMAIL PROTECTED]>
To: [email protected]
Sent: Thursday, September 25, 2008 6:58:34 AM
Subject: Re: [Access VBA Central] Open a SNAPSHOT file using VBA?


Sorry I was unclear. Let me clarify: 

How do I open a MICROSOFT ACCESS SNAPSHOT VIEWER file (filename.SNP) 
via VBA? 

Thanks!

Dennick 

--- In AccessVBACentral@ yahoogroups. com, Mark Bartnik 
<bartnikmark@ ...> wrote:
>
> 
> 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.OpenConnect ion("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.OpenRecords et("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: AccessVBACentral@ yahoogroups. com
> From: [EMAIL PROTECTED] s.com
> 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]
>

    

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

Reply via email to