How to refresh an MDW ?

  • Thread starter Javier G via AccessMonster.com
  • Start date
J

Javier G via AccessMonster.com

Hi,
How can I refresh my new active MDW by code ?

I'm using Access 2003 with the following code to link to the new active MDW,

Private Sub Command21_Click()
Dim dbe As DAO.PrivDBEngine
Dim wrk As DAO.Workspace
Dim dbs As DAO.Database

Set dbe = New PrivDBEngine

dbe.SystemDB = CurrentProject.Path & "\" & "MyNewActiveMDW.mdw"
dbe.DefaultUser = CurrentUser


Set wrk = dbe.Workspaces(0)
Set dbs = wrk.OpenDatabase(CurrentDb.Name)

Set dbs = Nothing
Set wrk = Nothing
Set dbe = Nothing

MsgBox "FINNISH,......BUT NOT REFRESH !"
End Sub

But untill I do Not close and open again the BD it does Not take any effect.
Even if I check Tools-->Secury-->Workgroup Admin shows "MyNewActiveMDW.mdw"
but when I check by code show something deferent:

MsgBox "MDW (method 1)= " & SysCmd(acSysCmdGetWorkgroupFile)
MsgBox "MDW (method 2)= " & DBEngine.SystemDB

Shows me the old MDW = SYSTEM.MDW

How can I refresh my new active MDW by code whith out closing and opening
again the BD or via MENU Tools ??

thank you !
 
T

TC

How about describing what problem you are trying to solve? Then
someione can tell you the proper solution.

TC
 
J

Javier G via AccessMonster.com

OK, Thank you for the answer !!

In that case Please:

1-Confirm if the CODE is correct ??

2- How to QUIT from the DB and return back to the active form (is that
possible) ???

regards
 
J

Javier G via AccessMonster.com

TC said:
How about describing what problem you are trying to solve? Then
someione can tell you the proper solution.


Ok,.......I'm , connected to the standard system.mdw (for example),.......
after some circunstances I need to conect to another (deferent) MDW .

How can I get connected and REFRESHED to the new MDW without quit the active
DB , Is this possible ???? (But Not via MENU-->Tools-->Security)

If the only way is quiting the DB how to come back to the active Form ??

Thank you !
 
L

Lynn Trapp

1-Confirm if the CODE is correct ??

I don't see any particular problems with the code, except that it won't do
what you want it to.
2- How to QUIT from the DB and return back to the active form (is that
possible) ???

You have to do more than quite the DB. You have to close the Access session.


--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html
 
T

TC

WHY do you have to connect to the other mdw?

Try descrbing your problem from a functional viewpoint.

Your problem is NOT that you have to connect to a different workgroup
file.

Your problem is "blah blah blah". Tell us what is "blah blah blah" !!

HTH,
TC
 
J

Javier G via AccessMonster.com

Thank You for answering TC !

Starting with Bla......bla.....bla ;-)))

The main reason is: Access 2003 (Russian version, maybe others not) has the
standard SYSTEM.MDW file as READ-ONLY attribute marked !
That for,.......... I can Not modify or create or delete pragmatically the
USERS and ADMIN permitions. I get ERROR (I do not remeber which one now, but
I can check later,.....)

I think....... may be I'm completely wrong is:

1- Create a new SYSTEM.MDW which by defect is Not marked as READ-ONLY and to
join this new group. So I will be able to make changes, but I can Not get
activated or refresh !!!!!! (HERE is the problem)

2-Possible Solution two is changing the attribute, without creating new
SYSTEM.MDW

3-Possible Solution is to Quit from Access and return back to the form.

Any more ideas ???

Regards
 
R

Rick Brandt

Javier said:
Thank You for answering TC !

Starting with Bla......bla.....bla ;-)))

The main reason is: Access 2003 (Russian version, maybe others not)
has the standard SYSTEM.MDW file as READ-ONLY attribute marked !
That for,.......... I can Not modify or create or delete
pragmatically the USERS and ADMIN permitions. I get ERROR (I do not
remeber which one now, but I can check later,.....)

Why on earth would you want to modify users/groups in the default System.mdw
file?
 
T

TC

Hi Javier

I'm not sure that I understand your problem, but I will try to help :)

2003 (Russian version, maybe others not) has the
standard SYSTEM.MDW file as READ-ONLY attribute marked !

Well, that is wrong in my opinion. You should un-set that attribute.
You can't do any harm by that.


That for,.......... I can Not modify or create or delete pragmatically the
USERS and ADMIN permitions. I get ERROR (I do not remeber which one now, but
I can check later,.....)

As Rick said, you shouldn't normally alter the default system.mdw file.
The proper way to secure a database, is to create a new workgroup file,
with a unique Workgroup Identifier (WID). If the new workgroup file is
marked as read-0only, you should un-set that attributew. (Ie. change it
back to read/write). Then, you start your database from a shortcut that
uses the /wrkgrp switch to select the new workgroup file. Google this
group on the word "wrkgrp", you'll find lots of hits about it.

HTH,
TC
 
J

Javier G via AccessMonster.com

Thank you for answering TC and for trying to understanding me.


1-Please forget about changes in System.mdw …….. OK ?

2-Starting from My Aplication MDB I’m linked to AnyWorkGroup.mdw

3- After creating a New Group with the following code:

Application.CreateNewWorkgroupFile CurrentProject.Path & "\” & “MyNewGrup.
mdw"

4-I check if I’m actived to this MDW:
From MENU>> Tools>> Security>> Worgroup Administrator
Shows “MyNewGrup.mdw" as active group but this is FALSE !!!

Because I check it by two deferent ways:

(A)
MsgBox "MDW (Method 1)= " & SysCmd acSysCmdGetWorkgroupFile)
MsgBox "MDW (Method 2)= " & DBEngine.SystemDB
Shows: "AnyWorkGroup.mdw" as active


(B) Visually, checking the Windows directory shows the MDW as a Microsoft
Office Access Record-Locking Information.
Shows: "AnyWorkGroup.mdw" as active


So I need to get Activated or Refreshed to this recent created group
(“MyNewGrup.mdw") How ??


Please explain if this is possible pragmatically (Using Access 2003) ??
 
T

TC

Two things.

First, Tools >> Security>> Workgroup Administrator is not the correct
way to see which workgroup file you are currently using. That only
shows you which workgroup file is the /current default/ workgroup file.
But you might not currently be using the current default workgroup
file! The proper way to check which workgroup file you are currently
using, is the two ways you show in (A).

As you can see, creating a new workgroup file does not cause Access to
start using that new file. The only way to get Access to use the new
file, for the normal user interface, is to quit Access & restart it
with a shortcut using the /wrkgrp switch.

But Javier, you still haven't told us why you /NEED/ a new workgroup
file! Pretend for a moment that you have never heard of workgroup
files. What are you actually trying to do - tell us without mentioning
workgroup files, at all!

HTH,
TC
 
J

Javier G via AccessMonster.com

QUESTION:
"you still haven't told us why you /NEED/ a new workgroup"

ANSWER:
The only reason is because I wanted to protect my BD in a deferent way.

Regards
Javier
 
T

TC

Javier, the steps for protecting a database using Access user-level
security, are described in detail, in various documents; for example,
the Access Security FAQ, often mentioned in this newsgroup.

The steps do begin by creating a new workgroup file. But they /do not/
include, getting Access to switch to that new file, "mid stream". You
misunderstand how Access uses workgroup files.

I suggest that you follow a written lst of explicit instructions, like
the FAQ that I mention above.

HTH,
TC
 
J

Javier G via AccessMonster.com

Dear TC:

In any case I appreciate you help & support, even if was not able to explain
you more.

Regards
Javier
 
T

TC

OK, sorry I couldn't help you more. I do know lots about workgroup
files, but I still don't see what you are trying to achive from an
end-user viewpoint.

Good luck!
TC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top