A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Date in Field Returns Y for Yes



 
 
Thread Tools Display Modes
  #1  
Old August 17th, 2005, 05:00 PM
JanetF
external usenet poster
 
Posts: n/a
Default Date in Field Returns Y for Yes

Hello,

I have a query in which there is a date field. I need to write a SQL
statement that says if there is a date, then populate the field with a "Y"
for Yes, otherwise "N" for no. Not sure how to do this. Can anyone help?
Thanks in advance.

Janet
  #2  
Old August 17th, 2005, 05:07 PM
Allen Browne
external usenet poster
 
Posts: n/a
Default

Type something like this into the Field row of your query:
HasADate: IIf([Date1] Is Null, "N", "Y")

Replace "Date1" with the name of your date field.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"JanetF" wrote in message
...
Hello,

I have a query in which there is a date field. I need to write a SQL
statement that says if there is a date, then populate the field with a "Y"
for Yes, otherwise "N" for no. Not sure how to do this. Can anyone help?
Thanks in advance.

Janet



  #3  
Old August 17th, 2005, 05:19 PM
Chaim
external usenet poster
 
Posts: n/a
Default

Janet,

Try something like:

SELECT Iif(IsNull([YourDateField], "N", "Y") from [YourTable];

Good Luck!
--
Chaim


"JanetF" wrote:

Hello,

I have a query in which there is a date field. I need to write a SQL
statement that says if there is a date, then populate the field with a "Y"
for Yes, otherwise "N" for no. Not sure how to do this. Can anyone help?
Thanks in advance.

Janet

  #4  
Old August 17th, 2005, 05:30 PM
JanetF
external usenet poster
 
Posts: n/a
Default

Thanks! That worked.

Janet

"Allen Browne" wrote:

Type something like this into the Field row of your query:
HasADate: IIf([Date1] Is Null, "N", "Y")

Replace "Date1" with the name of your date field.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"JanetF" wrote in message
...
Hello,

I have a query in which there is a date field. I need to write a SQL
statement that says if there is a date, then populate the field with a "Y"
for Yes, otherwise "N" for no. Not sure how to do this. Can anyone help?
Thanks in advance.

Janet




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Import date field problem. Thief_ General Discussion 1 July 18th, 2005 10:11 AM
Restrict Date Field? Peggy M General Discussion 1 February 2nd, 2005 03:19 PM
Rowsource of Field List Mark Using Forms 5 December 20th, 2004 01:42 AM
Filtering on custom date field MED Contacts 3 September 17th, 2004 03:05 PM
Aggregating Date Data into Weeks and Quarters Roger Running & Setting Up Queries 3 July 11th, 2004 05:56 PM


All times are GMT +1. The time now is 08:31 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.