Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / April 2008

Tip: Looking for answers? Try searching our database.

Default date for Null field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lrgm - 24 Apr 2008 23:44 GMT
I created an expression to fill null fields in one of my tables with a
designated default date using the IIf function.  The null fields were filled
but when I apply a <=[question] criteria, records containing the default
dates are not always included, depends on the criteria date.  Does this issue
sound familiar?

Thanks!  

Signature

lrgm

Evi - 25 Apr 2008 00:14 GMT
We'll call your Datefield XDate

Instead of the IIF what about trying

DateNull: DateValue(NZ([XDate],#24/04/2008#))

(I've set the default date to 24/04/08 in this example - oddly, I typed it
in the way Access usually prefers ie #4/24/2008# but it changed it to a
'normal' date)
Evi

> I created an expression to fill null fields in one of my tables with a
> designated default date using the IIf function.  The null fields were filled
[quoted text clipped - 6 lines]
> --
> lrgm
Ken Sheridan - 25 Apr 2008 13:01 GMT
Evi:

This is another one of Access's little foibles to confuse us Yurpeans.  In
query design view dates are in the format of the local regional setting.  
This even applies to date literals delimited by the # character.  If you
switch to SQL view you'll see that its in mm/dd/yyy format there.

With a date like 24 April it doesn't matter of course as there is no month
24, but with a date like 5 April then #05/04/2008# this would usually be
understood to be 4 May regardless of the regional date format in use, but in
query design view does in fact represent 5 April where the regional date
format is set as dd/mm/yyyy in Windows control panel.

I do wonder whether MS simply overlooked this when 32 bit Access was
introduced.  In version 2 the regional setting was respected both in
functions like CDate, and in date literals using the # date delimiter
character.  With Access 95 date literals had to be in US short date or an
otherwise internationally unambiguous format.  Maybe they simply forgot to
change it in the query designer.  It doe seem to be a strange anomaly
otherwise.

Ken Sheridan
Stafford, England

> We'll call your Datefield XDate
>
[quoted text clipped - 19 lines]
> > --
> > lrgm
Evi - 25 Apr 2008 20:18 GMT
Thanks for explaining that Ken. I thought that Access was just taking the
Mick! I guess I'll have to format my date fields to avoid any possible
errors.

Evi
> Evi:
>
[quoted text clipped - 43 lines]
> > > --
> > > lrgm
Rick Brandt - 25 Apr 2008 00:21 GMT
> I created an expression to fill null fields in one of my tables with a
> designated default date using the IIf function.  The null fields were
[quoted text clipped - 3 lines]
>
> Thanks!

Please explain where you put this expression.  You cannot "use an expression
to fill Null Fields" unless you mean you used it in an UPDATE query.

Signature

Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com

John W. Vinson - 25 Apr 2008 03:50 GMT
>I created an expression to fill null fields in one of my tables with a
>designated default date using the IIf function.  The null fields were filled
[quoted text clipped - 3 lines]
>
>Thanks!  

If you are selecting the records to be updated by using a date range
criterion, NULL values will not be found. NULL is not less than [question],
nor is it greater than [question], nor is it equal to [question] - it's just
unknown and will not match any criterion other than

IS NULL

If you want to update all records where Datefield is NULL, just use a
criterion of IS NULL on datefield; no IIF is needed. If that's not what you
want to do please explain.
Signature


            John W. Vinson [MVP]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.