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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter query to use default data when none is entered 1

Status
Not open for further replies.

MeldrethMan

Technical User
Feb 3, 2012
69
GB

In a query that asks for a Start Date I'm trying to cater for people just hitting return when asked. If they do this I'd like the start date to be some default value. This SQL produces no results so suggestions what's wrong?

PARAMETERS [Enter Start Date] DateTime;
SELECT qryAllContacts.FirstName, qryAllContacts.Surname, qryAllContacts.[Record Created]
FROM qryAllContacts
WHERE (((qryAllContacts.[Record Created])=IIf(IsNull([Enter Start Date]),#1/1/1990#,[Enter Start Date])))
ORDER BY qryAllContacts.Surname;
 
What about this ?
WHERE (qryAllContacts.[Record Created]>=[Enter Start Date] OR [Enter Start Date] Is Null)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top