473,511 Members | 10,041 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AutoExec Macro Help

27 New Member
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 "tblLastUpdate" with a field "DateUpdated"
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("*",tblLastUpdate","[DateUpdated]#="&Date()&"#")=0

but it gives me a missing operator syntax error any help would be wonderful
Jan 13 '11 #1
4 2053
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
Try
DCount("*",tblLastUpdate","[DateUpdated]=#"&Date()&"#")=0

I think you should be able to do simply:
DCount("*",tblLastUpdate","[DateUpdated]=Date()")=0
The last solution is neater and faster, and should work, though I havent done much work in macros.
Jan 14 '11 #2
kini113
27 New Member
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....
Jan 14 '11 #3
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
And you have tested that the expression
DCount("*",tblLastUpdate","[DateUpdated]=Date()")=0
evaluates as you expect it to?

Ie. that it is false when you have data for that date in the table.
Jan 14 '11 #4
kini113
27 New Member
Changed it to make it a true statement and it works :) Thanks so much for your help
Jan 14 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
4001
by: MLH | last post by:
My autoexec macro in an Access 2.0 database has 2 lines. The first runs DoMenuItem - Database - Window - Hide. The second lines is Runcode - Initialize(). Initialize is a procedure in a global...
4
6152
by: mvivar | last post by:
Hi everybody: This will be not easy to explain as my mother language is not english, so my apologies in advance if it sounds confusing. We have a database access 97 wich controls time of...
5
1862
by: MLH | last post by:
I have problems getting the CTRL-d, CTRL-w and other 'hotkey combo' assignments to work in Access 97. I just imported the autoexec macro directly from Access 2.0, so its no surprise. Some are...
6
3634
by: MLH | last post by:
Did A97, perchance, do away with the need for an AutoExec macro to initiate an autoexec sequence for databases? Or, must we still suffer with that hideous macro?
6
6424
by: Takeadoe | last post by:
Dear NG, Can someone assist me with writing the little code that is needed to run an update table query each time the database is opened? From what I've been able to glean from this group, the...
2
1573
by: dstorms | last post by:
Something very strange going on here! Don't know where dstorms original post went! The post, in essence, stated that his form, containing a checkbox and a textbox, opened fine if opened...
1
2097
by: Pittsford | last post by:
I used Sendkeys extensively in Access 97 to enter repetitive text into fields directly in a table. I am now using Access 2000 and none of the SendKeys macros work. I allowed Access to "convert" the...
8
18751
by: kini113 | last post by:
I want to update my database every night at 10pm. I have a Macro that runs all of the queries needed to update the database (which is also saved as a VBA module) and an AutoExec Macro to runs the...
4
4552
by: kini113 | last post by:
I want to update my MS Access database every night at 10pm. I have a Macro that runs all of the queries needed to update the database (which is also saved as a VBA module) and an AutoExec Macro to...
0
7148
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7367
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7089
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5072
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
451
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.