going from A2K to Office 2007

R

Rondy

Hi... I'm having a hard time finding an easy resource to determine the basic
programming changes between Access 2000 and 2007.

Even silly little things like Environ("USERNAME") and Chr(13) & Chr(10)
don't seem to want to work in 2007, and it has been frustrating trying to
figure out what to replace them with. Converting using the A2007 tool,
trying to open it at all in A2007 in any way shape or form, have rendered the
resulting file useless.

Can someone please point me in the right direction... or will a programming
book for Access 2007 answer these types of questions? (heading to bookstore
at lunch)
 
D

Douglas J. Steele

Environ and Chr both work in Access 2007.

Is ANY code working? If not, have you remembered to put the application in a
Trusted Location and/or enabled code?
 
J

Jack Leach

From what I gather (although admittedly I've never used '07), there shouldn't
be that many major changes in vba between the new and older versions. At
least, I haven't heard many other people coming here to ask about it, or read
it in any articles, etc, so I'm assuming the changes aren't monstrous.

I should note that using the Environ() function is bad practice and can lead
to some troubling issues... these environment variables can be easily changed
by any outside sources. The *real* method for getting this data comes from
APIs. You can go to mvps.org/access and browse the API section for things
like getting the username, computername, special folders, etc. They're all
aptly named and well described so it shouldn't be that hard.

Based on things like Chr(10) or Chr(13) not working... well AFAIK they
should be. And I'm guessing that this is just a couple examples out of a
multitude of problems you are having. The Chr() functions I believe should
run exactly the same no matter what version or host application VBA is
running.

For that reason, I would suggest looking at the references (VBA Window ->
Tools -> References....) to verify that all of the required references are
there and in the right order. Usually problems with "normal" code not
working can come back to this.

I'm not sure who else has writeups on the differences between '07 and
previous versions, but Allen Browne does an excellent job comparing
everything that's different about the versions. Go to
www.allenbrowne.com/tips.html and you will see it in his list.

hth

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
R

Rondy

Jack,

I wouldn't have thought there would be many diffs either, which is why I was
caught so off-guard by this weirdness. I did actually read Allen Browne's
tips for converting to 2007, but it didn't answer the issues I was having.

You guessed right that it was really a multitude... but I think I've
temporarily resolved most of them by creating a new A2K version mdb in Access
2007, then re-linking tables and importing everything else.

I had tried that before, but without realizing I could set it up from the
get-go as A2K version (so it didn't work before, natch). At least now I can
get this thing into workable condition, then gradually migrate it to 2007
accdb. ::: whew! :::
(so glad because we run our business with this database!)

But here's something I've noticed since trying this new way... for some
reason, and on only some queries, Access decided to add Expr1: type field
names in front of only some fields in those queries. On one of them, it even
named two different fields Expr1! So that's been fun to work thru this
afternoon... but it's nothing compared to the panic I was in earlier!

Thanks for the API info, I'm sure I will find plenty of useful functions
there. I only ever used Environ for some really simplistic functions like
open this report for these people, that report for those people... not for
any real security measure.

Thanks so much for your help!

Rondy
 
R

Rondy

Douglas,

Yes, some code worked... just stuff that didn't seem like it would need help
didn't work. For example, the error message I got on any function where I
had included Chr(), Format(), etc. said that those were user-defined
functions or the reference was missing.

I guess I didn't think those were functions that would need to have separate
ref libraries in addition to Access' own standard refs...

Anyway I am going to have to do some serious catching up on the new
functionality, especially new interaction with Word and Print to PDF
functions.

I think I have gotten it almost fully functional by creating new A2K version
in 2007 and importing, which is a good thing since we're upgrading all
hardware and software next weekend.

Will managers ever truly understand the time required for these kinds of
changes?? LOL

Thanks for your help,
Rondy
 
J

John W. Vinson

I guess I didn't think those were functions that would need to have separate
ref libraries in addition to Access' own standard refs...

The problem is most likely due to the way Access (all versions since 2.0!!!)
handles references. If *ANY* reference is Missing, then it's very likely that
NONE of them - builtin or addin - will work.

It may be that there was some additional .DLL file to the four basic Access
ones in the database, and it did not survive the upgrade. Did you see anything
marked MISSING in the References list? Were you able to uncheck it and compile
successfully?
 
D

David W. Fenton

The problem is most likely due to the way Access (all versions
since 2.0!!!) handles references.

You know, I never encountered reference issues until A97 (I didn't
work in A95 long enough to run into it, I wager). I always thought
that the move to VBA was what introduced the references problem. I
don't have Access 2 installed on this machine to check, but in a
code window is there a list of references on one of the menus?
 
R

Rondy

John,

Yes I did have a missing reference, to pdf.ocx

Still doesn't seem right or logical that Chr() and Format() would be cursed
because of that... but what ever seems truly right or logical anymore anyway,
right?

Now that I have it in a runnable state, I'm going to be re-writing my print
to PDF code to use the new built-in PDF capabilities (SO LOVE THAT!).

Thanks for the explanation,
Rondy
 

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