Results 1 to 6 of 6
  1. #1
    Frannilea is offline Novice
    Windows 10 Access 2007
    Join Date
    Jul 2020
    Posts
    27

    Microsoft Access Failed to Create the Visual Basic Module

    Hi!

    I have a very small database that I have made just for home use. Please find it attached. I have learned to program to make this only fairly recently. I couldn't find an app that suited my purposes, so I made one. However it seems that one of the forms has developed some kind of corruption. It was working fine previously, then I made some minor alterations (just added a field and associated DCount code, changed some expression builder sources and rearranged some form aesthetics. Even then, throughout the process it was fine - I constantly test it throughout the altering. It only started having this problem after I had finished it and started using it. Now when I load the form, the expression builder code works fine, but the VBA code doesn't load, and when I try to get into my coding, it gives the titled message.



    I tried compact and repair. It did quite drastically reduce my file size (although this is a very small database, so size from 4888K to 1428K), but it made no change to the actual problem. I'm using Access 2007 (yeah, I know it's old, but it's what I have). Of course, I did some research and found that importing to a new database often works, so I tried that. It imported my tables fine, but had major problems with ALL my forms, basically saying it couldn't find any paths. Weird... It's only the one form that is the problem (STATS - altering). I'm making some form changes, and those in progress are copies with "altering" added to the name. Please also find attached the results of the weird import. It got stuck in some weird error message loop, so I had to Cntl-break out of it. Look, the rest of my forms work well, including the original form I was altering (STATS). What's the problem? And how do I fix it?

    Gee, I thought Access was a reliable app. Large companies use it, right?? For much larger databases than mine. It only got to less than 1.5 Meg for goodness sake!! That's tiny!!

    Thanks in advance!
    Attached Files Attached Files

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,880
    I dont believe you can name a form with spaces and special characters like your doing. "FormName - altering"
    start with a clean database and import all your objects except those named like above.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  3. #3
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,742
    Really screwy problem. The class code module names did not agree with the form names. You couldn't rename the forms because Access couldn't find a class code module with the same name to change.
    So for each form affected:
    I opened the code module, selected and cut (CTRL-X) the code.
    Then set the property for the form's "Has Module" to no.
    Closed the form and renamed it.
    Opened the renamed form, set a random event procedure to get to the code module, then pasted the saved code from above.

    Here you go - Clean compile, no runtime errors:

    MyCurrentLearningWords-davegri-v01.zip

  4. #4
    Frannilea is offline Novice
    Windows 10 Access 2007
    Join Date
    Jul 2020
    Posts
    27
    Ah! Okay. I just copied my changes for one form onto the old form, and it's working fine now. Thank you so much!! I was trying to ensure they stood out, so that I remembered which were the forms I was working on. I'd learned the lesson of taking a copy of a form to work on it when I'd previously altered a form, then had difficulty getting it to work again, lol (I'm using the app as I'm altering it, so that was annoying). So now I always work on a copy, then replace it when I'm confident it's working. I'll use a different naming convention, lol! Perhaps, ListeningALTER or something to make it stand out.

    Many thanks, again!

  5. #5
    Frannilea is offline Novice
    Windows 10 Access 2007
    Join Date
    Jul 2020
    Posts
    27
    Ah thank you!! Yes, I also tried to rename and was puzzled when I couldn't - no error or anything, just no result. Of course, I had no idea why, being a complete noob, lol! And I only have a vague idea about what a class module is. My previous programming experience prior to VBA was at about 10 years old writing a tic-tac-toe program on a TRS-80 in B.A.S.I.C., to save onto cassette tape!! Ooooh...about 40 years ago!! Them was the days!! This was gonna be a very simple program to reflect language learning flash cards...it kinda grew... I keep thinking up new ways to improve it like adding timers and counting up scores and stuff... (I have to admit, I'm quite enjoying the challenge). Also, it's kind of procrastinating instead of learning Korean language (which is a lot bloody harder!!)

    Now I'm looking at the last bit - the Archived words, that I want to make sure I don't forget, and trying to work out a way to get them to appear fortnightly for a period of time, then monthly for a period of time. I have some ideas... Let's see if it works!!

    Thanks!!

  6. #6
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,742
    I had a TRS-80 also in the late 70s. And I remember getting a 5 1/4 floppy disk drive to replace the idiotic, unreliable, slow tape drive. I still have a signed book by the author of TRS-DOS.
    There was a very popular and lengthy magazine published at the time called TRS-World or something like that. I had 2 coding articles accepted and printed. Paid me 60 bucks!
    Things have certainly changed for the better.

    Glad to help with your problem. It took a while to diagnose, but after that the fix was not hard at all.
    Good luck with the continuing project and thanks for the star.

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

Similar Threads

  1. Replies: 3
    Last Post: 02-17-2018, 02:28 PM
  2. Replies: 1
    Last Post: 08-23-2017, 10:21 AM
  3. Microsoft Visual Basic for Applications
    By jtradergp13 in forum Access
    Replies: 1
    Last Post: 01-25-2017, 10:30 AM
  4. Replies: 1
    Last Post: 10-01-2014, 06:21 AM
  5. microsoft visual basic REFERENCE
    By marianne in forum Access
    Replies: 0
    Last Post: 04-01-2009, 08:06 PM

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