Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Aug 2002
    Location
    Wichita, Kansas, USA
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Access macro (2000)

    We have a macro that calls another macro. We want it to repeat the 2nd macro until it reaches the end of file, so we have the repeat expression be while the acct num is not null. We are using a Go To Next Record Command in the second macro. So when it gets to the end of file, there won't be anything in the acct num, and the second macro will quit running.

    We recently changed the data to be in SQL tables, which are linked into the Access front end. Now the macro gives an "action failed" error when the "go to next record" macro command is run and it is already on the last record. Is there a way to test for EOF in the macro conditions or repeat expression? Or any other ideas on how to tell when it is already at the last record so it won't give an error when it gets to the end of the file?

    This was complicated to explain, so hope you can follow. Thanks for your help!

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Access macro (2000)

    This sort of thing doesn't work well when you are using macros - you will probably have to switch to VBA where you have some error handling capabilities to deal with this situation. In VBA you can test for an EOF condition using either ADO or DAO as your data access method. Once you begin to explore VBA and it power, you'll rarely write macros.
    Wendell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •