View Full Version : Set value upon no data returned


Uvuriel03
12-23-2008, 12:22 PM
I'm not even sure this is possible. I have a query that, assuming the needed data is there, finds the highest number from a list. Easy.

Here's the hard part.

I can't figure out how to set an automatic first number, just in case there isn't one already there.

I THINK I need to use an IIF() statement, but I have NO idea how to imply the lack of data within it. It would basically look like;, IIF( {no data is returned from}[insert code here],1,[code])

Anybody have any ideas?

RuralGuy
12-23-2008, 03:56 PM
How about using a DMax() function instead of a query and if a null is returned then insert your initial value?

Uvuriel03
12-24-2008, 04:14 AM
I hadn't thought about that. I shall have to test it. ^__^

Uvuriel03
12-24-2008, 05:06 AM
The Dmax() in conjunction with a little bit of coding worked like a charm! I had to use IfNumeric() to avoid getting a lack of data error, but it works perfectly! Thanks for the idea! ^__^

RuralGuy
12-24-2008, 05:43 AM
Glad I could help. Merry Christmas.