VBA Problems

D

David C. Holley

Something weird is going on. I was in the process of debuging a form
(frmReservations) in Access. As a part of this, I created a copy of the
form (frmReservations_backup). Once I had figured out the problem with
the original. I deleted it and then went to rename the _backup to the
original. At first, Access really didn't like that indicating that a
form by that name already existed, although I had deleted it and it
didn't appear in the DB window. Then when I tried to view the VBA code
for the backup, Access started through an error message - "Error
accessing code. The connection to the network might have been lost."

I did a compact and repair on the db file, which didn't work. I then
imported the form into a fresh db file, which seemed to fix the problem,
but then when I started working with a function in a module that I
exported and imported, Access would throw the error message at me when I
tried to ADD parameters to a sub.

I've already done a uninstall/reinstall of ALL of Office on the chance
that this would fix it, but it didn't.

Any ideas?

FYI: Office 2000 Pro on WinXP

David H
Come on baby lite my fire: www.spreadFirefox.com
 
J

Jim Vierra

I believe you need to make sure that all of your madules and forms can
compile without error after you have imported them. If you start working
with and changing code when it can't be compiled it will sometimes screw up
the code database. A corrupted form file can wreck havoc on the whole
project. In 2000 I have had to cut and paste the code by hand to fix just
this kind of problem.

COde module are text so they usually don't need to be cut/pasted but they do
need to compile error free before you start working with them. This will
not happen if you have autocompile set off. Also lack of option explicit
can create problems depending on the code you are using.

I would also suggest that you have all of the latest service packs
installed. Pre-SP1 had some problems.
 
D

David C. Holley

Yeah, I figured that that the bad form was the problem (and I spent all
of *(*$&5 Monday building it.
 
J

Jim Vierra

I have had success with copy the code to a test file then deleting it from
the form then select all of the forms controls and pasting them in a brand
new form. I was never able to figure out how the form got hosed but I
didn't spend a huge amount of time on it since at that time I moved to XP
and found the problems went away.

Watch out - one thing that will cause this symptom is a circular reference
between forms. On form definition is dependent on a second form and that
reference the first form. The compiler in 2000 can't handle this. In XP it
will tell you there is a circular reference (I think - it's been a couple of
years. In 2003 I haven't checked but I would bet it does.
 
J

Jim Vierra

I always liked Office 2000. It was probably the first version that was
relatively complete from the programming perspective.
 

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