Send Object Macro, Need Help!!

Send Object Macro, Need Help!!

Post by SE9XIERPIE » Sun, 28 Aug 2005 00:53:48


hi,

I've created a send object macro that runs everytime i open the main form in
my database. THis macro is setup to email me a query. WHat i want is for it
to only email me when there are records in the query. The way i have it set
up now, it emails me whether or not there are records in the query.

thanks for looking!
 
 
 

Send Object Macro, Need Help!!

Post by SE9XIERPIE » Sun, 28 Aug 2005 00:55:08

hi,

I've created a send object macro that runs everytime i open the main form in
my database. THis macro is setup to email me a query. WHat i want is for it
to only email me when there are records in the query. The way i have it set
up now, it emails me whether or not there are records in the query.

thanks for looking!

 
 
 

Send Object Macro, Need Help!!

Post by RXJpYyBCbG » Sun, 28 Aug 2005 04:39:02

In the conditions statement of the macro for the sendobject command
DCount("[RecordId]", "queryname")>0
 
 
 

Send Object Macro, Need Help!!

Post by SE9XIERPIE » Sun, 28 Aug 2005 04:48:05

Eric,

thanx for your concern, but a "condition Statement" does not exist in the
macro properties, is there another way to do this???
 
 
 

Send Object Macro, Need Help!!

Post by Steve Scha » Sun, 28 Aug 2005 05:28:12

To reiterate my response to your earlier thread on the same topic....

Use a Condition for the macro. If you can't see the Condition column in
the macro design window, select it from the View menu. The Condition
will look something like this...
DCount("*","YourQuery")>0

Please post back if you still can't figure it out.

--
Steve Schapel, Microsoft Access MVP
 
 
 

Send Object Macro, Need Help!!

Post by SE9XIERPIE » Sun, 28 Aug 2005 05:59:03

Hey Steve,

Its all clear now, i got it to work,

thanks a lot!
 
 
 

Send Object Macro, Need Help!!

Post by VG9tIFdpY2 » Mon, 29 Aug 2005 18:57:14

You won't be able to achieve this result using a macro. It's time to start
learning how to program using VBA (Visual Basic for Applications) code. Here
is a general outline of the steps required:

1.) Declare database and recordset variables
2.) Set database variable to currentdb, for example:
3.) Set recordset variable to source query
4.) Use an IF...THEN test to test for recordcount
ie. If rs.recordcount > 0 Then
DoCmd.SendObject........
End If

5.) Close the recordset and database variables and then set each = nothing
6.) Don't forget to include error handling code.

If you are interested in pursuing this idea, then post back and I can
provide a more complete sample. If, on the other hand, you are not willing to
venture beyond macros, then you'll have to live with the current situation.

If my answer has helped you, please answer yes to the question that reads
"Did this post answer the question?" at the bottom of the message thread.


Tom

http://www.yqcomputer.com/
__________________________________________



hi,

I've created a send object macro that runs everytime i open the main form in
my database. THis macro is setup to email me a query. WHat i want is for it
to only email me when there are records in the query. The way i have it set
up now, it emails me whether or not there are records in the query.

thanks for looking!
 
 
 

Send Object Macro, Need Help!!

Post by Steve Scha » Tue, 30 Aug 2005 04:23:54


Eh? What? Did you read the original poster's post yesterday? To quote
them: "i got it to work".


--
Steve Schapel, Microsoft Access MVP
 
 
 

Send Object Macro, Need Help!!

Post by VG9tIFdpY2 » Tue, 30 Aug 2005 04:40:01

Steve,

I had not noticed the follow-on thread, until you just mentioned it.

Okay, I was wrong....one can use DCount in the conditions for a macro. I'm
just so conditioned to avoid using domain aggregrate functions that I
overlooked that possibility.

Tom
_____________________________________