Results 1 to 4 of 4
  1. #1
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875

    Exporting Forms to another Database

    How can I export a Form (along with it's VBA code) from one version of a database to another?



    We're using a split database here at work and frequently receive updates to the frontend from our corporate offices. Whenever I attempt to export the custom Forms I've designed to a new version from corporate, the frontend becomes unable to make a connection with the backend data rendering it unusable.

    Currently I'm just exporting all our custom Queries and Reports, but since that doesn't work with the Forms, I have to remake all of them from scratch every time we receive an update.

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    I too would like the answer to this one.

  3. #3
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Since it looks like nobody have a quickie answer for me, I did some more looking around on the interwebs last night.

    It actually is starting to look like Microsoft did this on purpose, possibly to prevent people from easily stealing code by copy/pasting completed Forms from other DBs into their own.

    Which I guess I understand, but it still sucks for me

    Anyway, one possible way to get around this would be to remove all the Code from a Form before copying/exporting it and then simply putting the code back afterwards. This still isn't a perfect solution because it's possible you'd need to remove all "[Event Procedure]" references as well (and put them back afterwards too).

    Well, it's still something to look at and, if I have the time today, I'll give it a try.

  4. #4
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    OK, I've played around with Forms some more and have come up with the following method of successfully copying a Form from one database to another:

    The database you're copying the Form FROM will be called FromDB and the database you're copying TO will be called ToDB.

    1. If you're just updating a Form that already exists in ToDB , skip to Step 3.
    2. Create an empty Form in ToDB and give it the EXACT SAME NAME as the database you're copying from FromDB. Don't worry about the size or contents of the Form.
    3. Extract all of the VBA Code from FromDB's Form (including the Options at the top and all functions). Save this information in a text editor such as Notepad and then remove it completely from FromDB's Form.
    4. Select all of the Objects in FromDB's Form (Command Buttons, Text Boxes, Labels, etc.) and Copy them to the Clipboard.
      1. If you want to keep the spacing as well, simply draw four small lines that each touch the outer edge of one of the sides of the Form before selecting and copying everything.

    5. Open the Empty Form in ToDB and Paste the Objects into it. The Form will automatically expand to fit the contents.
      1. If you drew lines in step 4.1, delete them at this time.

    6. Copy the VBA Code into ToDB's Form. Be sure to replace the Options, etc. at the beginning of the code.
    7. Make any changes to the layout of your Form (removing Record Selectors, Scroll Bars, etc.).
    8. Save your Form and Compact the database.

    I realize this is a little clunky, but if you've got a complex form with a lot of Objects and VBA Code, it's still much faster than rebuilding it from scratch.

    I'll leave this Thread open for another 24 hours or so to see if anyone else has any input. If not, I'll mark it Solved at that time.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Exporting Help
    By mrnikeswsh in forum Import/Export Data
    Replies: 11
    Last Post: 01-16-2010, 11:59 AM
  2. Really Need Help With Exporting to Excel
    By graviz in forum Import/Export Data
    Replies: 0
    Last Post: 09-24-2009, 08:29 AM
  3. Replies: 4
    Last Post: 04-01-2009, 08:49 PM
  4. Forms: Not immediate change of database
    By firlanu in forum Forms
    Replies: 5
    Last Post: 08-11-2008, 12:04 PM
  5. Exporting a Switchboard
    By Hawkx1 in forum Forms
    Replies: 1
    Last Post: 07-08-2008, 06:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums