Avatar of ES-Components
ES-ComponentsFlag for United States of America

asked on 

If an SQL statement returns no data how can I enter a value in a field?

Select Sum(ext-price) From ordertable
WHERE shipdate=date()

 As long as the shipdate is equal to the current day the above select statement will Sum the ext-price field. That is okay. How do I fix the select statement to enter 00.00 in the ext-price field if there is no order for the current day?
This is being displayed on my webpage that uses Dreamweaver.

Obviously if the condition is not met there is no data to sum. So how do I fill in this field with zeros?

Any help would be appreciated
Thank you
Rick
Microsoft Access

Avatar of undefined
Last Comment
Argenti
ASKER CERTIFIED SOLUTION
Avatar of Argenti
Argenti
Flag of France image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Argenti
Argenti
Flag of France image

Or if you want to have the value formatted

SELECT FormatNumber(Str(IIf(Sum(ext-price) is Null, 0, Sum(ext-price))), 2) 
FROM OrderTable
WHERE shipdate=date()

Open in new window

Avatar of ES-Components

ASKER

Fantastic!!!! This code works perfectly. It is just what I needed
 Thank you for your help.
RICK....
.
Avatar of Argenti
Argenti
Flag of France image

I'm glad you're happy! Thanks for the points.
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo