Copy all code from one Access db to another (1 Viewer)

jacko6

New member
Local time
Today, 14:43
Joined
Jul 17, 2023
Messages
25
I have two Access dbs that are identical except for the bitness and 32bit vs 64bit API code.

I want to make UI changes (only) to all of the forms - different font, larger font, increased field sizes etc. While a lot of these UI changes can be done with code, there's always manual adjustments that need to be made to get the redesigned UI just how one wants it, which is time consuming.

I'm wondering if there is a way to quickly copy all of the code from one Access db to another? If so then I would only have to make the UI changes to say the 32bit version. Then create a copy, delete all the code, then paste in the code from the existing 64bit version.

P.S. I know I could have one db that is coded to function in both 32bit and 64bit environments but, that's not what I currently have.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:43
Joined
May 7, 2009
Messages
19,243
ctrl-c then ctrl-v, this will make a copy.
now maybe you are concerned with tables, but them in backends
so only the FE gets updated.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:43
Joined
Oct 29, 2018
Messages
21,473
I know if you delete the event stub you lose the connection with that event. But if you do it like Arnel said, maybe you won't.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:43
Joined
Feb 28, 2001
Messages
27,186
I'm with ArnelGP on this. A simple Windows Explorer style of copy will do what you need. That will leave you with TWO x your 32-bit app files, one of which you can use to make the 64-bit mods. The other one IS the 32-bit app, no problems there. Doing it that way means even the event linkages are intact.

As ArnelGP points out, you need the database to be split, with data to be in a "pure" back-end that has no code in it, and all the code in the front-end, which is the only thing you would have to copy.
 

jacko6

New member
Local time
Today, 14:43
Joined
Jul 17, 2023
Messages
25
Perhaps I didn't explain myself clearly enough.

My aim is to make the UI changes to the 32bit version.
Then make a copy of this file which will become my 64bit version.
But rather than spend time making changes to the 32bit code to make it 64bit compatible, I want to copy the code that I already have in the original 64bit db.

So my question is, can all of the code be easily copied from one db to another? I'm trying to avoid copying code form by form, module by module.
 

ebs17

Well-known member
Local time
Today, 08:43
Joined
Feb 7, 2020
Messages
1,946
Easily is a strong word.

Deal with the SaveAsText and LoadFromText methods. This allows you to export or reimport the definitions of the objects of an access file into text files. You get to a process by looping over the objects.
However, when it comes to forms and reports, the definition of the interface and the definition of codes go hand in hand. With higher demands, you would have to deal with the contents of the text files and implement your own measures independently - and that could be the end of “easy”.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:43
Joined
May 7, 2009
Messages
19,243
if you, correctly define the APIs using:

#If VBA7 #Else #End If

then you don't need to worry to use it on x32 or x64.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:43
Joined
May 7, 2009
Messages
19,243
I know I could have one db that is coded to function in both 32bit and 64bit environments but,
we can help convert it so you eliminate most of your problem and you only have 1 db that can be used on both bitness.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:43
Joined
Feb 19, 2002
Messages
43,275
@arnelgp 's last suggestion is your best option. You really don't want separate code bases if you can avoid it. THAT is the simple method.

I use the export/import from text in most of my apps for backup. It doesn't just import/export code, it also includes the interface so you end up with a a file for each form but it is both the object definition and the code in one file. Very useful for backup but not so useful for your objective. Use arnelgp's suggestion
 

jacko6

New member
Local time
Today, 14:43
Joined
Jul 17, 2023
Messages
25
Thanks, I'll have a look at export/import from text.

In this instance I can't have one db for both bitness because of 32bit/64bit activex components that I require.
 

isladogs

MVP / VIP
Local time
Today, 07:43
Joined
Jan 14, 2017
Messages
18,221
If all your users are on Access 2010 or later, you don't even need the conditional compilation that @arnelgp mentioned in post #7
If you need two separate code bases due to having a number of ActiveX controls that don't work in both bitnesses, then I would look for alternatives that aren't dependant on those controls
 

Users who are viewing this thread

Top Bottom