Macro conditions help

R

Robert Williamson

I am trying to create a macro that will look into a table
if possible to see what values are in the date field, I
ain't having any luck.

I need it to stop further processing of the macro if it
finds a record that matches the current date. My thinking
was to use something like now()=[issued date] and the
macro action would display a message box stating that a
report for this day had already been done and then it
would stop, if the above was not true it would generate a
report and use an update query to change the value in the
table to the current date.

I have been unable to get this to work with a table or
query, I have been forced to use a Form. Howeber the
macro appears to be having a problem with the now()
request on the form as it does not acknowledge it and
processes the full macro. I have changed the condition as
a test to [issued date] is null to see what would happen
with a nil entry in the table and it ackowledged this and
stopped the macro.

I hope I have made some sence and would appreciate any
help offered.

thanks
 
N

Nikos Yannacopoulos

Robert,

I can't be 100% certain this is your case, but there's a
very good chance it is (trust me, this is painful
experience talking) so you might want to give it a shot:

Dates are just numbers for Access (for all of Office, for
that matter), regardless of format, which is just for the
eye.
Function Now() returns current date AND time, so the
number returned has a decimal part (e.g. 37946.63 greek
time, a few secs ago). In your table, though, the dates
are most likely imported from another application/system
or entered by the user, thus containing no decimal. As a
result, your condition is something like 37946 = 37946.63,
therefore it is never met!
If this is indeed your problem, you can fix it by using:
Int(Now())
instead of Now(), so as to get rid of the decimals.

Nikos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top