condition a job

G

Guest

I am trying to condition the running of a macro. I have a form that asks for
the date of the last day of the previous year, I store this date in a table.
I only want this macro to run once a year, so if the date entered on the form
is the same as the one I stored in the table, I would like a message stating
that the job has run for the date entered and terminate the job. Any help
would be appreciated.
 
G

Guest

You don't need a form to figure out the last day of a year since you can
calculate it with the in-built date functions (look in Access help). This is
assuming you want 12/31 of the desired year. Access is well aware that
December is the last month in a year and that it always has 31 days. The
current year is known and you can get the previous year by simply subtracting
1.
You would use the DLookup function (see Access help) to check if the data
already exists in the table.
I'd use VB procedures rather than a macro to do this, however.

-Dorian
 
G

Guest

Thanks for the assistance, I am not any good in VBA, so I try to accomplish
working in Access using macros.
 
G

Guest

John,

I would just like to encourage you to ventrue off into the VBA world of
Access. You will find that it is not as mystical as it may first appear to
be.

When I developed my first database application using Access, I worked very
hard usiing macors to try to accomplish the desired results. I was quite
proud of that project. Then a friend of my came by and began to show me how I
could accomplish the same or better results with VBA. Wow, it was an eye
opener.

I then found that I could have Access convert my macros into VBA code.
That's where I started and from there I used these newsgroups as well as many
other sources to just continue the learning curve.

Give it a try. Many here will be more that glad to help.
 
G

Guest

VBA is just as easy to use as macros and you can accomplish a lot more.
Access help will answer most questions you may have. Use this forum as a last
resort.

-Dorian
 

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