Re: Select a specific instance of Access
From: John Nurick (j.mapSoN.nurick_at_dial.pipex.com)
Date: 07/22/04
- Next message: Stein: "Copy field names to Excel along with recordset"
- Previous message: BRC: "Access Users"
- In reply to: Andrew Jones: "Select a specific instance of Access"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 22 Jul 2004 22:19:18 +0100
Hi Andrew,
If the only reason you're using Shell() is to pass the username and
password so you can get at the data, you can do it with code like the
sample procedure below. (It was written for VBScript but is easily
modified for VBA.)
If on the other hand you actually need to automate the instance of
Access, see this article for a way of getting hold of the instance yuo
need:
How To Automate a Secured Access Database Using Visual Basic
http://support.microsoft.com/default.aspx?scid=kb;EN-US;192919
Dim dbE 'As DAO.DBEngine
Dim dbW 'As DAO.Workspace
Dim dbD 'As DAO.Database
Dim rsR 'As DAO.Recordset
Set dbE = CreateObject("DAO.DBEngine.36") 'VBS, late binding
'Set dbE = New DAO.DBEngine 'VB/VBA, early binding
dbE.SystemDB = "C:\temp\xx\secured.mdw"
Set dbW = dbE.CreateWorkspace("Test", "Amoss", "Elsie")
Set dbD = dbW.OpenDatabase("C:\temp\xx\test.mdb")
Set rsR = dbD.OpenRecordset("Query1")
With rsR
MsgBox .Fields(0).Value 'demo only
'Add a record:
' .AddNew
' .Fields(FileName).Value = strResultsFileName
' ...other fields if needed...
' .Update
End With
rsR.Close
dbD.Close
dbW.Close
Set rsR = Nothing
Set dbD = Nothing
Set dbW = Nothing
Set dbE = Nothing
On Thu, 22 Jul 2004 07:45:12 -0700, Andrew Jones <Andrew
Jones@discussions.microsoft.com> wrote:
>I have a module in an access 2000 database that uses a shell
command to open another database (I use the shell command to automate
the username and password since we are on a workgroup security file -
KB192919). The database opens but when I use the getobject function, it
selects the first instance of access, but I want it to select the one I
just opened with the shell command.
>Any ideas on how to set the focus to a specific instance of access?
>
>Thanks,
>Andrew
-- John Nurick [Microsoft Access MVP] Please respond in the newgroup and not by email.
- Next message: Stein: "Copy field names to Excel along with recordset"
- Previous message: BRC: "Access Users"
- In reply to: Andrew Jones: "Select a specific instance of Access"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|