call a macro when record added and field set to 'True'

G

Guest

I have a macro that calls a query and outputs the results to a form, the form
is then printed and another query is called to clear out the orignal results.
The macro runs fine, my question is - How do I get the macro to run when a
field is set to 'True' without intervertion from the user?
I need this to run in the background, the database is updated from another
application ( the database will not be open). What I would like is that when
a record is added and the 'Print Form' is set to 'True' the macro runs.
 
D

Douglas J. Steele

How is Print Form set to True? Is it a checkbox on a form? If so, put code
in the checkbox's On Click event.
 
G

Guest

The 'Print Form' is a field in the access table. I was hoping that when a new
record is added and this field is set to 'true' the macro kicks in, runs the
querys and prints the form (without user intervention).
Can this be done?
 
S

Steve Schapel

Boomer,

Does your existing macro already detect the most recently added record?
If not, you will need to add this provision. Then, your closed
database will itself have no way of detecting when a new record has been
added, so this will have to be controlled externally. I don't know
whether this will be possible from within the "other application" where
the appended data comes from, or whether you will need to use a batch
file or some such... you haven't really given much information about
what this is all about. But you can run a macro in an Access database
by using a Command Line switch, something along these lines...
"C:\PathToAccess\Msaccess.exe" "C:\PathToDB\YourDatabase.mdb" /x
NameOfMacro
 
G

Guest

You are looking for something called table trigger.
MS Access does not have this feature, you'll have to program it.

Mauricio Silva
 

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