AutoExec Macro Help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kini113
    New Member
    • Aug 2009
    • 27

    AutoExec Macro Help

    I have 2 AutoExec macro's that run at a specified time every morning (1am) but 1 of those macros can't be run more then 1 time a day. I found a set up on a previous post that almost solves my problem, but the StopMacro condition gives me a syntax error.
    Here's what i have so far...
    A table named "tblLastUpd ate" with a field "DateUpdate d"
    A query in the macro which will append that table with the date it runs on. (should this be an append or an update query?)

    The Macro condition i found is
    DCount("*",tblL astUpdate","[DateUpdated]#="&Date()&"#") =0

    but it gives me a missing operator syntax error any help would be wonderful
    Last edited by kini113; Jan 13 '11, 10:27 PM. Reason: Vague info
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    Try
    DCount("*",tblL astUpdate","[DateUpdated]=#"&Date()&"#") =0

    I think you should be able to do simply:
    DCount("*",tblL astUpdate","[DateUpdated]=Date()")=0
    The last solution is neater and faster, and should work, though I havent done much work in macros.

    Comment

    • kini113
      New Member
      • Aug 2009
      • 27

      #3
      I don't get an error message with those condition syntax but it doesn't stop the macro from running even when the condition is met. Baffled....

      Comment

      • TheSmileyCoder
        Recognized Expert Moderator Top Contributor
        • Dec 2009
        • 2322

        #4
        And you have tested that the expression
        DCount("*",tblL astUpdate","[DateUpdated]=Date()")=0
        evaluates as you expect it to?

        Ie. that it is false when you have data for that date in the table.

        Comment

        • kini113
          New Member
          • Aug 2009
          • 27

          #5
          Changed it to make it a true statement and it works :) Thanks so much for your help

          Comment

          Working...