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

Have blank fields - but want to force data in?

Status
Not open for further replies.

tinkertoy

Programmer
May 10, 2002
25
US
I have a field that comes across blank there is no data, but in the query, if the field is blank I want to force a specific string into it. I tried IsNull and IIf expression, and a combination of, but, I get a data type error or no data at all. The field is a Date/Time Field, and if it is Null then I want to put a default date in of 01/01/1901. The date doesn't really matter, it is just necessary to have data in it. thanks!!

[ponytails2]
 
I "think" that you may be trying to fill data into the many side of a relationship when a record doesn't exist.
Your problem would be at the table level not the query level and if this is so, you could put a default Value in the table to make sure it always gets what you want.
 
Haven't seen your SQL, but the following should
show 01/01/1901 if the field is blank, the contents
of the field otherwise. ("YourDate" represents the
name of your date field):

IIf(nz([YourDate])=0,#01/01/1901#,[YourDate])
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top