Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using variables as conditions in macros

Status
Not open for further replies.

Jusenkyo

Programmer
Aug 16, 2002
295
GB
Hello all

I have a chunk of code that counts records in a few queries and whacks the answers into 3 variables.
The code then runs a macro which emails three reports.
Fairly simple stuff.

What I want to do is to reference the variables created, and only send emails in the macro if this variable is >0.

Ive tried just putting- [Forms]![Form1].[Countqry]>0 - in the conditional part of the macro - but it doesn’t recognise the object.

I could, of course, create three new macros with just the one email in each, and use the conditions in VB. Or I could move the emailing part into VB.

But I have quite a few emails going out, and this would be a pain in the neck to implement.

Anyone know how to reference variables in Macro conditions?

Cheers in advance
J
 
Get rid of obsolete macro stuff and play with VBA code.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Yeah, I thought that. But like I said, there are alot of macros that I would have to convert!
 
As PHV says get rid of the macro and use VBA, which will Access convert for you. Go to DB window click on the macro then go the menu and click save as VB module you can then use as many variables as you want.

Savil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top