Type mismatch

  • Thread starter Thread starter Yodaboy
  • Start date Start date
Y

Yodaboy

On opening a database I have created, I have an auto exec macro which runs a
report to tell me when I have expired records in my database. This then runs
another macro which if the expired records total more than 1 pings a pop up
message to tell me i have expired records. Howver if there are no expired
records the macro runs and errors with a type mismatch error. Please help the
macro code is

[Reports]![Expiring Records]![Total Expired]>0

i have tried zero's, "", Null and sums that = zero and it still doesnt work.

HELP ME OBI WINDOWS KENOBI YOU ARE MY ONLY HOPE!

Thanks
 
Take a look at the Nz() function. I suspect you are trying to compare
something to "nothing there". Your expression might look like:

Nz([Total Expired],0)>0

(but I don't have any idea what your underlying data structure is, and
that's what you'd have to refer to...)

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Yodaboy,

In addition to Jeff's comments, I am wondering about how you are doing
this. You appear to be trying to read the value of a control on your
report as the Condition for your macro. I would recommend another
approach. I suggest you make a query that returns the expired records.
Forget the report. And you don't need to "open" or "run" the query
when the database opens. Then you can just use this in the Conditiuon
of your macro:
DCount("*","NameOfYourQuery")>0
 
Back
Top