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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
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 |