Results 1 to 7 of 7
  1. #1
    lmnnt is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2011
    Location
    Darwin NT Australia
    Posts
    16

    2007 to 2010 macro won't work


    I had this problem (below) previously which you guys helped me with - the solution was SetWarnings to No - at the beginning of the macro. It worked in 2007 but I'm now on 2010 and I'm back to getting the "can't find the database file". Can anyone help please?
    Thanks
    I have a macro that imports a number of files from one source and places them in a single table. Not all the files come in at the same time but I need to start processing the ones that I do receive as soon as I get them. Currently, if a file has not yet been filed into the source the macro stops. What I need the macro to do is ... if x file isn't there - then continue. As I say the files come in over a period of days

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Need code or the project (or extract of the problem objects) to analyse.

    I don't use macros, only VBA. VBA is more versatile and easier to debug.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    lmnnt is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2011
    Location
    Darwin NT Australia
    Posts
    16
    Hi June 7 - sorry - I'm not sure what you need.

  4. #4
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Post the XML from your macro so we can see what you have and perhaps give you suggestions on how to change it. I would think you can now do error handling in your macro since 2010 has some better error handling. So you should be able to move to the next step or exit if the file doesn't exist. I don't have 2010 with me here at the moment. I had to leave my netbook at home this week.

  5. #5
    lmnnt is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2011
    Location
    Darwin NT Australia
    Posts
    16
    Hi Bob, thanks for that - here it is - there are many more files to import so I kept just a few as an example - hope it's enough. Re: error handling - no, I just get the "can't find" error message and then another pop up which only gives "stop" as an option
    Thanks

    Function Copy_Of_M001_Import()
    On Error GoTo Copy_Of_M001_Import_Err
    DoCmd.SetWarnings False
    DeleteImportErrTables
    DoCmd.OpenQuery "M001_Delete_SQL", acViewNormal, acEdit
    DoCmd.RunSavedImportExport "Import-STUDENT_0001"
    DoCmd.RunSavedImportExport "Import-STUDENT_0002"
    DoCmd.RunSavedImportExport "Import-STUDENT_0003"
    DoCmd.RunSavedImportExport "Import-STUDENT_0006"
    DoCmd.RunSavedImportExport "Import-STUDENT_0007"

    DoCmd.OpenQuery "M001_AllSchoolsStudent_Delete_SQL", acViewNormal, acEdit
    DoCmd.OpenQuery "M001_AllSchoolsStudent_INSERT_SQL", acViewNormal, acEdit
    DoCmd.RunMacro "M002_Run", , ""
    DoCmd.OpenTable "Append Tbl", acViewNormal, acEdit
    DoCmd.Close acForm, "F001_Import_Insert"

    Copy_Of_M001_Import_Exit:
    Exit Function
    Copy_Of_M001_Import_Err:
    MsgBox Error$
    Resume Copy_Of_M001_Import_Exit
    End Function

  6. #6
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    What is the M002_Run macro? What does it do? Also, you don't need to (nor should you) put the two commas and the double quotes for that line. When you don't have arguments, you don't include them. If you don't have arguments after the last thing you do have you just do not include the commas either. You only include the commas if there is another argument you are going to supply a value for. So it should be:

    DoCmd.RunMacro "M002_Run"

    just like that.

  7. #7
    lmnnt is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2011
    Location
    Darwin NT Australia
    Posts
    16
    Hi Bob
    Thanks for that. Macro M002 runs some queries and puts them into a table - again there are quite a few.

    Here it is...
    Option Compare Database
    '------------------------------------------------------------
    ' Copy_Of_M002_Run
    '
    '------------------------------------------------------------
    Function Copy_Of_M002_Run()
    On Error GoTo Copy_Of_M002_Run_Err
    DoCmd.OpenQuery "FTE Other", acViewNormal, acEdit
    DoCmd.OpenQuery "FTE Yr 13 0", acViewNormal, acEdit

    Copy_Of_M002_Run_Exit:
    Exit Function
    Copy_Of_M002_Run_Err:
    MsgBox Error$
    Resume Copy_Of_M002_Run_Exit
    End Function

    I took out the commas and double quotes but it doesn't seem to have made any difference - I didn't add any commas etc I copied the vba. I'm confused because it all worked with Access 2007 - I don't really want to have to rebuild it. It works OK if I put dummy files in to match the RunSavedImportExport files but that kind of defeats the purpose doesn't it?
    Thanks

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

Similar Threads

  1. Replies: 4
    Last Post: 07-26-2011, 12:33 AM
  2. Code does not work in 64 Bit Access 2010
    By mwolfod in forum Programming
    Replies: 26
    Last Post: 12-12-2010, 04:39 PM
  3. Word.Basic ToolsSpelling won't work in Access 2010
    By stav.kaufman in forum Programming
    Replies: 6
    Last Post: 11-23-2010, 08:44 AM
  4. 2007 Access DB won't work in 2010 - 64 bit
    By InvGrp in forum Access
    Replies: 2
    Last Post: 07-12-2010, 08:45 AM
  5. 2007 doesn't work in Windows 7
    By InvGrp in forum Access
    Replies: 2
    Last Post: 05-24-2010, 03:23 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