[AccessD] 32->64 bit conversion
Arthur Fuller
fuller.artful at gmail.com
Fri Oct 29 10:17:42 CDT 2021
So what should I do with this app? It;s an app for a small shop, all of
chose computers run 64-bit Windows and Office. But should I perform the
steps for a conditional compile, just in case? And where should I place the
compiler directives (the #If VBA7) statements?
2. Should I just take all the Constants from that Ptr file and paste them
into a new mdule? Or alternatively just grab the Constants that I know I
will need? What is the cost of simply loading them all?
On Fri, Oct 29, 2021 at 7:22 AM Jim Dettman via AccessD <
accessd at databaseadvisors.com> wrote:
> Paul,
>
> << Should conditional compilation only be used in Access with some
> prescribed
> caveats?>>
>
> There really are none, and you should not leave a project in an
> un-compiled state as it will run slower.
>
> VBA has two major steps when working with code:
>
> 1. When you enter a line of source, the text is tokenized and checked
> for basic syntax errors.
> 2. VBA "compiles" the tokenized code, which basically means it goes
> through a whole bunch of checks to figure out how all that code relates and
> if it's valid. Last I knew, there were more than sixteen levels that the
> compiler would d code through before it was considered "compiled". I'm
> putting compiled in quotes because un-like a lot of other languages where
> you end up with an .EXE, VBA doesn't do the same thing (it's not linked
> code). Even with compiled code, it's still figuring out how to execute it
> at run time. When you "compile" your VBA project, it's just cutting out
> some of those checks.
>
> You can have a VBA project with just source and no compiled code.
> That's what /decompile leaves you with. Any compiled code is marked as
> invalid and it will be removed when a compact and repair is done.
>
> <<<< I understand Access likes to pre-compile its source and save it in the
> database file (the front end in a FE-BE system).>>
>
> VBA doesn't do that on its own. You must explicitly tell it to do
> that. But VBA only executes compiled code, so if you don't do it before
> hand, it will compile at runtime. It just won't save it.
>
> << If the source is written for conditional compilation (conditional
> according
> to how Access was installed on the computer) how does Access know when
> recompilation is required?>>
>
> I don't know for sure, but I would think it simply checks the values of
> any compiler constants against what the compiled code was compiled
> against. If it spots a difference, then it compiles everything again,
> just as it would if you changed a line of code.
>
> With 32 vs 64 bit, that's what happens. If you compile 32 bit,
> distribute as an .accdb, then run in 64 bit, VBA can (and does) compile on
> the fly. But if you distribute as an .accde (which has no source), then
> it cannot and won't run.
>
> HTH,
> Jim.
>
>
> -----Original Message-----
> From: AccessD On Behalf Of Paul Wolstenholme
> Sent: Thursday, October 28, 2021 4:59 PM
> To: Access Developers discussion and problem solving <
> accessd at databaseadvisors.com>
> Subject: Re: [AccessD] 32->64 bit conversion
>
> I have wondered about how conditional compilation works with Access.
> I understand Access likes to pre-compile its source and save it in the
> database file (the front end in a FE-BE system).
> The database file can be distributed and even shared in a multi-user
> environment.
> So perhaps the computer that was used for compilation is not necessarily
> the computer that executes the compiled code.
> If the source is written for conditional compilation (conditional according
> to how Access was installed on the computer) how does Access know when
> recompilation is required?
>
> One could avoid the issue by always decompiling the Access database before
> another computer uses it and never sharing an Access database except as a
> back end.
> But Access wasn't designed with that limitation.
>
> Should conditional compilation only be used in Access with some prescribed
> caveats?
>
> Paul Wolstenholme
>
>
>
> > On Thu, Oct 28, 2021 at 11:59 AM Bill Benson <bensonforums at gmail.com>
> > wrote:
> > ...
> > > When I was on a massive upscaling project, one with a lot of 32 bit API
> > > functions pre-existing in the code, I would put wrappers around that
> luke
> > >
> > > #If VBA7 Then
> > > The declarations that are 64 bit
> > > Office Compatible
> > > #Else
> > > The declarations that were 32 bit
> > > Office Compatible
> > > #End If
> > >
> > >
> > > Sometimes in addition or in substitution one would have also
> > >
> > > #If WIN64 Then…
> > >
> > > Etc.
> > >
> > > That is what conditional compilation is. Unfortunately this was only
> > > sometimes all my code required. Often I had to change how many of the
> > > variables in the rest of my code were declared as well. It is a long
> > > learning curve (or was for me) and took a long time to properly upgrade
> > > large apps to work in both environments. I think reading some of the
> > links
> > > others provided may be worth your time.
> > >
> >
> >
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
--
Arthur
More information about the AccessD
mailing list