Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Replication / June 2005

Tip: Looking for answers? Try searching our database.

block access to form's vba

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill H. - 19 Jun 2005 18:08 GMT
I'm posting here in case this is something related to replication (as I'm
working with a replicated db).

I hit a few keys by mistake (have cast on arm and makes for interesting
typing), and hit esc a few times to get back to typing, and suddenly I can't
edit one form's vba that I was working on at the time. I click on the build
by the event, and nothing happens at all.  In fact, I can't rename the form,
either.  I restarted access 2000 several times, rebooted the computer, and
same thing--no vba access.  All the other forms work fine.

I also had trouble closing the form.  It would not close when clicking on
the X, but I could resize it.

I ended up rebuilding the form.  At least access let me delete it.

But I'd like to know what happened.

Signature

Bill

David W. Fenton - 19 Jun 2005 21:00 GMT
> I'm posting here in case this is something related to replication
> (as I'm working with a replicated db).
[quoted text clipped - 13 lines]
>
> But I'd like to know what happened.

First off, forms/reports/macros/modules should not be replicated.
Only data tables and queries should ever be replicated. The reason
for this is because replication is a *Jet* technology, not *Access*,
and only tables and queries are pure Jet objects.

What this means is that you're taking risks with replicating Access
objects, because they have custom properties (from Jet's point of
view) that Jet won't necessarily know how to take care of.

Furthermore, front end updates are only ever one-way, never two-way,
but replication is entirely designed for two-way synchronization.

This means that changes to data in the objects end up getting
propagated over replication. A perfect example is a filter setting.
A user in one front end may filter a form. This gets automatically
saved when the form is saved, and that will be synchronized with the
other replicas. If every user is filtering their forms, that means
many conflicts.

But it's all a complete waste of time, because it's not data that
ought to be synchronized in the first place.

Now, keep in mind that from A2K on, your Access project (forms,
reports, etc.) is no longer stored in a series of records in a Jet
data table, but within a SINGLE RECORD in a Jet table (this is why
saving a change to a single form in A2K is slower than in A97,
because THE ENTIRE ACCESS PROJECT HAS TO BE SAVED, instead of just
the single form). What that means is that every change to a property
of a form/report, etc., means a change to the generation of the
record that holds the Access project, and that means conflicts,
conflicts, conflicts with all the other replicas.

WHat happens is that eventually (and sometimes very quickly) these
problems mount up and the whole project gets irretrievably
corrupted.

Now, it could be that you are *not* replicating the front end, and
simply encountered your garden-variety VBA corruption. This can
happen if:

1. you never compact your application while it is in development.

2. Access crashes while you're changing VBA code.

3. you do not turn off compile on demand.

4. you never clean up the crud by decompiling.

For information on this, see:

 The real deal on the /Decompile switch:
 http://www.trigeminal.com/usenet/usenet004.asp

I make decompiling a regular part of my development process. In A97,
I do it at least once a day when programming heavily. That consists
of this set of steps:

1. back up the MDB to be decompiled.

2. decompile it.

3. close the instance of Access used to decompile.

4. open a new instance of Access and compact the decompiled MDB.

5. in the same instance of Access open a module or the Debug window
and choose COMPILE AND SAVE ALL (A97) or COMPILE [project name]

6. run a compact again.

There are two main benefits to this process:

1. it keeps the MDB small and efficient

2. it works as the canary in the coal mine to inform you of
corruption of the VBA project early on.

Because of the 11 levels of compilation (see the Trigeminal.com
article), projects can become corrupt and still successfully
compile. When you decompile, the compiled code is tripped out and
all that's left is your VBA code. When you compile again, Access
will occasionally find compile errors that did *not* show up
earlier, because the problematic code was marked as already compiled
and not rechecked for correctness.

Last of all, in TOOLS | OPTIONS, be sure to turn off compile on
demand. In A97, this is on the MODULES tab, and you just uncheck
COMPILE ON DEMAND. In A2K and later, you go to the VBA code window
and choose TOOLS | OPTIONS and on the GENERAL tab, uncheck COMPILE
ON DEMAND. In both versions of Access, I add a COMPILE icon to the
toolbar and compile after every code changes (In A2K, I also save a
lot, since it's very easy to lose changes because of the
independence of the code window).

None of these issues are replication issues, though!

Signature

David W. Fenton                        http://www.bway.net/~dfenton
dfenton at bway dot net                http://www.bway.net/~dfassoc

Bill H. - 19 Jun 2005 22:41 GMT
interesting.

Whenever I make a new form, it is automatically a replica.  I'm never asked
to select whether or not I want it so.

When I'm all done, I'll likely split the database.  But at this point, it's
all in one access file.

--Bill
Paul Overway - 19 Jun 2005 23:11 GMT
Bad....you should split BEFORE you replicate.

Signature

Paul Overway
Logico Solutions
http://www.logico-solutions.com

> interesting.
>
[quoted text clipped - 7 lines]
>
> --Bill
David W. Fenton - 20 Jun 2005 19:38 GMT
> interesting.
>
[quoted text clipped - 3 lines]
> When I'm all done, I'll likely split the database.  But at this
> point, it's all in one access file.

While I occasionally at very early stages of development keep the
data and application in a single MDB, I hardly ever keep that setup
much past the prototyping stage. I don't even leave single-user apps
unsplit, simply because it makes it hard to distribute updates to
the front end.

You need to right away split your application. I don't know what
happens with unreplicated forms/reports, since it has never at any
point occurred to me to replicate anything other than data.

The longer you wait, the more likely you're going to lose the whole
project, which may or may not include your data.

Last of all, replication of the back end is something I'd most
likely implement only at the end of a project, just before it goes
into pre-production testing, since replication doesn't do anything
until there's data editing involved.

I have never quite understood why anyone would have replicated a
front end. All the Access help files (going back at least to Access
2) and all the documentation I've ever seen have recommended split
architecture for multi-user applications. I've never even once built
an app that went into production use without being split, and that
dates back to before I ever got involved with replication (in
1997-98).

While I guess the idea of using replication to push out changes to
the front end application has a certain kind of superficial appeal,
anyone who takes a minute to think about it should conclude that
it's not a very good idea at all.

Signature

David W. Fenton                        http://www.bway.net/~dfenton
dfenton at bway dot net                http://www.bway.net/~dfassoc

Bill H. - 20 Jun 2005 23:00 GMT
it's still very much in the development stage.

Guess I was a bit overanxious when I found "replication" and thought it
answered all my problems.

Suppose I can, in the end, import all the stuff, split, (maybe replicate)
and then send out for user testing.

I did find one interesting thing in that if I copied (DOS) to a new filename
the closed design master and then tried to open that copy, it was no longer
a design master.  How did access figure that out?

> > interesting.
> >
[quoted text clipped - 34 lines]
> anyone who takes a minute to think about it should conclude that
> it's not a very good idea at all.
David W. Fenton - 20 Jun 2005 23:56 GMT
> it's still very much in the development stage.
>
[quoted text clipped - 3 lines]
> Suppose I can, in the end, import all the stuff, split, (maybe
> replicate) and then send out for user testing.

Why would you do otherwise?

I think I'd create an entirely new replica set for the data files,
importing the tables from the old replica set, but omitting the
replication columns.

Then I think I'd export all the forms/reports to text, using:

 Application.SaveAsText [filename]

then import them into a new front end:

 Application.LoadFromText [filename]

I don't know if there are replication properties that are carried
over from there or not, or if there are, what happens when you
import a replicated form into a non-replicated MDB. Never having
created a replicated form/report, I just don't know.

Perhaps unreplicating the forms/reports before exporting would be
sufficient to get rid of any replication data.

> I did find one interesting thing in that if I copied (DOS) to a
> new filename the closed design master and then tried to open that
> copy, it was no longer a design master.  How did access figure
> that out?

Because it didn't have the same name as it had when it really was
the design master. What Access does when you open up a replicated
MDB is to check the MSysReplicas table to see what names are in the
Machinename and Pathname fields for the replica's current ReplicaID.
If it doesn't match, then it creates a new ReplicaID.

That's the whole key to the warning I gave you about machine name
and path with your thumb drives. You should simply never ever copy
replicas with the file system (DOS or Explorer) unless the replica
will *not* be opened or synchronized with in the new location/name,
or, unless you intend to create a new replica.

Signature

David W. Fenton                        http://www.bway.net/~dfenton
dfenton at bway dot net                http://www.bway.net/~dfassoc

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.