Results 1 to 13 of 13
  1. #1
    jlgray0127 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185

    Running a code in an inherited Database

    I have recently inherited a database. It's all written in code.
    I keep getting the error, Check the table name's accuracy.
    I have posted the code below. The you select the table name, and click the botton, and it is supposed to run this code... The table names are all accurate, so I am not sure what the error is trying to tell me. I am not really good with code yet.
    Can you please help point me in the right direction? Thank you!



    Private Sub cmdRun_Click()
    On Error GoTo Err_cmdRun_Click


    Dim strFile As String

    strFile = LCase(Trim(cboTable.Value))


    Call Master(strFile)
    MsgBox ("The macros have been created and exported to the appropriate folder.")

    Exit_cmdRun_Click:
    Exit Sub
    Err_cmdRun_Click:
    MsgBox ("Check the table name's accuracy.")
    MsgBox Err.Description
    Resume Exit_cmdRun_Click

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Here's what your code would look like if you used the Code Tags (the # button in Advanced)
    Code:
    Private Sub cmdRun_Click()
       On Error GoTo Err_cmdRun_Click
       Dim strFile As String   strFile = LCase(Trim(cboTable.Value))
       Call Master(strFile)
       MsgBox ("The macros have been created and exported to the appropriate folder.")
    Exit_cmdRun_Click:
       Exit Sub
    Err_cmdRun_Click:
       MsgBox ("Check the table name's accuracy.")
       MsgBox Err.Description
       MsgBox Err.Number
       Resume Exit_cmdRun_Click
    End Sub
    Add the RED line to the code and let us know what the number is.

  3. #3
    jlgray0127 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185
    Got the same error (table accuracy)
    "Invalid use of null" after that, and then the number

    94

  4. #4
    jlgray0127 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185
    I wish I could attach this thing. It's pretty elaborate... at least to me.
    It actually is used to upload data to CAPP+, which is used at the company I am currently working at, for maintaining work instructions, and such for our manufacturing process.
    It's my understanding, that there is a spread sheet that changes are made in, then this code is ran, and it updates the system in one huge batch, vs running through and updating all the different screens.
    I have used neither process, so without knowing code, or what the database is supposed to really do, in it's completeness, it's kinda difficult for a novice! LOL

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    You would have to investigate Master (a called routine) also since that seems to be where most everything must happen.

  6. #6
    jlgray0127 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185
    This is the Module called CAPPLUS MASTER

    WHY WOULD SOME OF THE TEXT BE BLACK, AND SOME BE GREEN? IS THIS RELEVANT?

    Function Master(ByVal strFile As String)
    'Call DELETE_OPNS(strFile)

    Call PARTS_MODIFY_RACK_FROM_SPREADSHEET_VER2(strFile)
    Call INSERT_PARTS(strFile)
    'Call PARTS_MODIFY_RACK_FROM_SPREADSHEET(strFile)
    'Call ADD_TOOLS(strFile)
    'Call RELATE_TOOLS(strFile)
    Call INSERT_LEVELS(strFile)
    'Call CHANGE_INSTRUCTIONS(strFile)
    'Call PARTS_MODIFY_RACK_DIFF_OPN(strFile)
    'Call ADD_TOOLS_VER_2(strFile)
    Call ADD_TOOLS_VER_3(strFile)
    Call RELATE_TOOLS_VER_2(strFile)
    'Call INSERT_LEVELS_VER_2(strFile)
    End Function

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    The green text is typically COMMENTS -- non executable code

    The ' mark at start of line identifies a comment

    It appears that your operational code is a version of the original code with some lines commented out.
    ; and modules with some revisions. It's pretty poor practice if there is no associated documentation
    to help a new person.
    Last edited by orange; 03-14-2012 at 07:41 AM. Reason: spelling

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Why can't you attach it? Can you zip it up and attach it?

  9. #9
    jlgray0127 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185
    I believe it is now attached.
    Attached Files Attached Files

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It really wants to be running on a certain PC. Have you moved it to a different PC? If you click to the left of the margin in the code window you can start a break point. then run the form and it will stop on at the break point. you can then single step with the F8 key and find which line is causing your error.

  11. #11
    jlgray0127 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185
    Yes. It is owned by one of our managers, here. He sent it to me asking me to fix it for him.
    I need to have it set up where I can just have the spreadsheet manually imported into the database, so anyone who owns it, can follow a written instruction and use this.

  12. #12
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Do you have written instructions on how to run it? Did that manager do the design?
    What does Fix mean to him?
    My first reaction was that it has almost 0 comments and inconsistent Dim statements and very limited error handling.
    I don't mean to be real negative, but without some existing instructions, and some discussion/communication with the developer/operator, I I think it's a very uphill task. Especially if you are trying to figure out what it's for and what it does exactly.

    I would hope this stuff exists, but if not I think this is how I would start.
    - some sort of high level picture showing how the pieces fit together.
    -for each of the called routines(purpose, inputs, outputs,process logic, error trapping)
    -set up a version control mechanism so 2 or 3 versions aren't in the same procedure and just commented out
    -documentation re one version and the next (what caused the change)
    -some test data/transactions that could help consistent testing
    -back up procedure to protect the "production system"
    -detailed instructions on how to set things up, how to run it
    - some meaningful current documentation on the system generally and each of the steps and processes involved

    There is a free tool MZTools http://www.mztools.com that can help you with some documentation and error handling.
    The tool has features to help find caller routines etc. Highly recommended.

    I hope this is helpful.

  13. #13
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Orange is correct but did we scare you off with the task at hand?

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

Similar Threads

  1. inherited properties
    By bginhb in forum Access
    Replies: 1
    Last Post: 03-10-2012, 08:42 PM
  2. Inherited database - macros don't work on new page
    By VictoriaAlbert in forum Access
    Replies: 3
    Last Post: 04-13-2011, 11:45 PM
  3. Ignore user input while code is running
    By Bigdoggit in forum Forms
    Replies: 5
    Last Post: 03-28-2011, 07:58 AM
  4. Missing references and running code at startup
    By springrider in forum Programming
    Replies: 1
    Last Post: 01-09-2011, 09:47 PM
  5. Replies: 3
    Last Post: 10-04-2010, 01:31 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