Open a Workgroup restricted MDB using VBA

Bilbo_Baggins_Esq

Registered User.
Local time
Today, 08:25
Joined
Jul 5, 2007
Messages
586
Does anybody have any old code snippets you've used to open a Workgroup restricted MDF file using VBA.

To be clear, this is NOT via ADODB or DAO.

This needs to be within an Access.Application Object.

I have code that uses objOrigin.OpenCurrentDatabase just fine for any unprotected database.

but I cannot seem to figure out how to pass the MDW though with the user id and password

here is the LATEST incarnation of what I've been trying.
IT IS NOT all I have done and is only provided to show some premise of a few of the syntax's I have already tried.

Code:
OriginDB = "C:\Users\mf86228\Desktop\csu2005_FE.mdb"
[COLOR="DarkGreen"]'OriginDB = Chr(34) & "C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE" & Chr(34) & " /wrkgrp " & Chr(34) & "C:\Users\mf86228\Desktop\csu.mdw" & Chr(34) & " /User " & Chr(34) & "sys adm telecoms" & Chr(34) & " /pwd " & Chr(34) & "lisakri" & " " & Chr(34) & "C:\Users\mf86228\Desktop\csu2005_FE.mdb" & Chr(34)
'OriginDB = Chr(34) & "C:\Users\mf86228\Desktop\csu2005_FE.mdb" & Chr(34) & " /wrkgrp " & Chr(34) & "C:\Users\mf86228\Desktop\csu.mdw" & Chr(34) & " /User " & Chr(34) & "sys adm telecoms" & Chr(34) & " /pwd " & Chr(34) & "lisakri" & Chr(34)
'OriginDB = "C:\Users\mf86228\Desktop\csu2005_FE.mdb /wrkgrp C:\Users\mf86228\Desktop\csu.mdw /User " & Chr(34) & "sys adm telecoms" & Chr(34) & " /pwd " & Chr(34) & "lisakri" & Chr(34)
'MsgBox OriginDB
'"C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE" /wrkgrp "C:\Users\mf86228\Desktop\csu.mdw" /User "sys adm telecoms" /pwd "lisakri" "C:\Users\mf86228\Desktop\csu2005_FE.mdb"[/COLOR]Set objOrigin = CreateObject("Access.Application")
With objOrigin
    .OpenCurrentDatabase OriginDB, True, "C:\Users\mf86228\Desktop\csu.mdw /User " & Chr(34) & "sys adm telecoms" & Chr(34) & " /pwd " & Chr(34) & "lisakri" & Chr(34)
    .Visible = False
End With

the last incarnation posted above tries to pass the mdw, userid and pwd using the password argument of the .OpenCurrentDatabase method.

HOWEVER, I have also tried it by piecing all of it together (ala old fashioned "shortcut properties") as you can see from some of the remarked strings.

I'm hoping maybe somebody might have some old code they used to use that can be dusted off?!?!?!
 
I did that 3 1/2 years ago. Will need to go home and dig something out of the file box. It used Access 2003 front end linked-table to SQL Server 2000.
What version of Access will you use?

/wrkgrpworkgroup information fileStarts Access by using the specified workgroup information file. Applies to Access 2002-2003 and earlier databases only.
 
hmmm, well I appreciate it but that is not sounding applicable.

The scenario here is:
a mdb back end
a mdb front end

Both the BE and FE are in the workgroup managed by the mdw.
They work together fine and this quest is NOT in relationship to that.
We can open either of them directly within Access 2010 and properly apply the userid and password managed by the work group database.


HOWEVER, for something new, I need to be able to programatically open the FE database as an object.

Hence the need for some variation of the code provided above.
I cannot do what I need to do with a DAO or ADODB connection via JET or ACE.

Surely this has been done before (albeit a very long time ago)...
 
anybody have any clues?

when I search the internet, all I seem to find are data connections using DAO and ADODB.

I need to be able to open the FE as an object
 
http://www.vb123.com.au/toolbox/05_access/workgroupfiles_shortcuts.htm
This jumped out at me, I think this is what I use to use.
Can you look it over (about half way down) and let me know?

To customize the shortcut on the Desktop, right-click it and choose Properties, as shown in Figure 10-15. The first item that you want to add to the target line is the full path to the database, which should occur directly after the path to the executable. Once the shortcut to the database works, you can start adding the commandline options. To demonstrate, I will show you a command line that will open a copy of the Northwind back-end database with a workgroup file and the Editor user (described in the section “Trusting Your Users by Adopting the Same Workgroup”).

You should organize these commands together in the shortcut’s target field. As you can see, after each argument is entered, you need to leave a single space before putting the required entry in the line. These shortcuts can be a bit cumbersome to build and test, so you should add each item one at a time.
C:\MSOfficeXP\Office10\MSACCESS.EXE c:\data\Northwind_be.mdb/wrkgrp c:\developer.mdw /user editor
NOTE: If a workgroup file or database is in a folder that has spaces in the name, you will need to enclose the path to the file in double quotes.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom