How to test for the absence of a date

When I install my application I set an installation date and store it in the registry.  But first I have to check that it's not already there.  Unfortunately the isdate() function returns True for a  date of 12:00:00: AM

Is there a way to test if an 'empty' date is greater than, say, 01/01/2000?

Thanks in advance,

Clive
Clive BeatonAccess DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
How can it be Empty yet have a value ?
And this Date is in the Registry ?
0
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
Is there a way to test if an 'empty' date is greater than, say, 01/01/2000?
it depends on how you get and validate your date value.

dim yourVar as date
yourVar = <how you get the value??>

Open in new window


then try like:

if yourVar >#01/01/2000# then
    'Greater than 01/01/2000
else
    'Less or equal to 01/01/2000
end if

Open in new window

0
Gustav BrockCIOCommented:
The  date of 12:00:00: AM is really 1899-12-30 00:00:00 because the numerical value of that is 0 (zero). Thus, it makes sense, that this value is the initial value of the registry entry.

Using this info, the test could be:

If InstallDate = #12:00:00 AM# Then
    ' Registration date has never been set.
Else
    ' InstallDate holds the last registered date.
End If

Open in new window

0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Clive BeatonAccess DeveloperAuthor Commented:
Sorry, I was using the term 'Empty' as a generalization.  I guess I could have asked the question better.  What I Want to do is:

Set a registry entry with a date.
Get the registry entry and return a date.
Detect if the registry entry did not contain a date.

CRB
0
Gustav BrockCIOCommented:
Set and get, you wrote, you have running.
All that was missing was the check for not containing (= never been set) a date. That was provided.
0
Clive BeatonAccess DeveloperAuthor Commented:
On some client machines, I get  0:00:00 , not 12:00:00 AM
0
Clive BeatonAccess DeveloperAuthor Commented:
Is there a way of checking if a registry entry actually exists?
0
Gustav BrockCIOCommented:
That's just a different format. The value is the same.
0
Gustav BrockCIOCommented:
Is there a way of checking if a registry entry actually exists?

Either try to read it and catch an error. If no error, it exists.
Or read the key and enumerate the entries. If your entry is not listed, it does not exist.
0
Clive BeatonAccess DeveloperAuthor Commented:
How do I read the key and enumerate the entries?
0
Gustav BrockCIOCommented:
An example can be found here:

How to read a registry key and its values

It is VBScript which easily can be transferred to VBA.
0
Dale FyeOwner, Developing Solutions LLCCommented:
Dates are actually stored in your database as double precision numbers, with the integer portion representing the date and the decimal portion representing the % of the day which has passed.  If Install date is showing up as 00:00:00 or 12:00:00 AM then that represents a value of zero (0).  The following should meet your needs.

IF INT(InstallDate) = 0 then
    'no value
Else
   'has been set
end if
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Clive BeatonAccess DeveloperAuthor Commented:
Thank you both very much.

CRB
0
Dale FyeOwner, Developing Solutions LLCCommented:
glad to help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.