Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    test a query before running (Access 2K)

    I am messing with someone else's db (always a fun thing! <img src=/S/blackteeth.gif border=0 alt=blackteeth width=20 height=20> ) and the previous developer has implemented a slew of macros that seem to run different queries is a sequence. Apparently, one of the macros bombs because a previous query returned no records. Is there a way to check for no records before opening a query in a macro?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: test a query before running (Access 2K)

    I would convert the macros to VBA and insert tests between the calls to DoCmd.OpenQuery. You can use DCount to count the number of records in a table or select query.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: test a query before running (Access 2K)

    hmmph! not sure i feel so generous with someone else's code base... i don't really know what this db is trying to accomplish and don't want to muck it up. i personally (almost) never rely on macros as they are hard to maintain.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: test a query before running (Access 2K)

    > i personally (almost) never rely on macros as they are hard to maintain.

    That's why I suggest converting them. Select a macro in the database window, then select File | Save As..., and choose Module from the "As" dropdown list in the dialog. Access will generate the equivalent VBA code for you.

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: test a query before running (Access 2K)

    magic!! I will try.

Posting Permissions

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