Results 1 to 6 of 6
  1. #1
    jassie is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    40

    Access compile and check for references

    From what I have seen on the internet, once an Access .mdb file is converted to the .accdb format, I would need to


    1. compile,
    2. check for references,
    3. compact and repair, and
    4. open to test.

    Since I am new to working with Access 2013 (I have worked with vb.net in visual studio), I will understand what you are referring to. I just have not worked with VBA in Access before. Thus can you tell me or point to links that will tell me how to accomplish the goal I have?

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    compiling option can be found in the vba editor under the debug tab.

    compiling will fail if references aren't correct

    compact and repair option can be found under the database tools tab or file tab

  3. #3
    jassie is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    40
    Thank you for your help so far!

    I have the following additional questions to ask:
    1. I did find the compile under the debug tab. However the 'compile' option was dark black when I clicked and it has remained 'gray' for the last 2 hours. Thus it seems to me it is having a problem, correct? Where will I see compile errors? I have the 'immediate window' open and there are no error messages. Thus can you tell me where I look for the error messages as?
    2. Where can I find the references that need to be possibly changed? Also are there directions on how to change the references?

  4. #4
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    compile goes grey because it is disabled, and it is disabled because the code is compiled - make a change to the code and you can compile again. Errors are seen during compiling, you will get an error message in a popup box and the offending line will be highlighted - messages are generally quite clear once you understand the terminology - syntax error, object not defined, etc. If there are no issues, compiling typically takes less than a second

    The immediate window is for monitoring code
    1. you can insert into your code debug.print somevalue where somevalue is an equation or value of a variable for example e.g. debug.print date(0 will display todays date in the immediate windoe
    2. while the code is running but paused, you can type into the immediate a questionmark, followed by an equation or value - e.g. ?Date() will display todays date on the next line

    under Option Compare Database put
    Option Explicit

    this will force the compiler to ensure all variables are declared

    references should be updated automatically - e.g. a reference to MS Excel from 2003 will update to the relevant one for 2007 - however you might want to consider latebinding. Note if you are using transferspreadsheet you may need to change the reference from Excel 4 to Excel 12. There will be other changes (for example you now need to refer to the ribbon rather than menuitems)

    You change references under the tools tab.

    One other tip, you can set breakpoints in your code so it will stop when the breakpoint is reached (go to the line you want to stop at, hit F9 or click on the grey bar to the left or with menu debug tab, select toggle breakpoint). A maroon dot will appear in the grey bar and the line highlighted in maroon as well. To step forward to the next line of code, hit F8 or hit F5 to resume the code.

    You might find this tutorial helpful - or google 'access vba tutorial' for more options

    https://msdn.microsoft.com/en-us/lib...ffice.12).aspx

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by jassie View Post
    ...I have the 'immediate window' open and there are no error messages. Thus can you tell me where I look for the error messages as?..
    Unlike visual studio, the build to intermediate language is not displayed in the build/output window. Errors will halt the compile at the line the compile error happened. This is odd because it can take you to a completely different module. Then, the process starts over. If you get one error and then fix the error, you need to compile again to look for a second error.

    Also, the references window is located under Tools, from within the VBA IDE.

  6. #6
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    You probably should do a Compile before converting, as well as afterwards.

    Also, you need to keep in mind that while VB/VB.Net and Access VBA do have a common ancestor, they are not the same language! They have many Functions/Properties in common, with identical names, but what they do and how they work are not necessarily the same, in both languages!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. MS Access Compile Error
    By B00592816 in forum Access
    Replies: 12
    Last Post: 06-19-2014, 06:56 AM
  2. Replies: 7
    Last Post: 11-17-2011, 02:56 PM
  3. Replies: 9
    Last Post: 10-13-2011, 01:30 PM
  4. Sharepoint Access Services References
    By is49460 in forum SharePoint
    Replies: 0
    Last Post: 11-09-2010, 09:42 PM
  5. Best References on Access
    By evander in forum Access
    Replies: 4
    Last Post: 10-14-2010, 10:58 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