Clear a date variable
geo3701
Posted messages
60
Status
Member
-
pijaku Posted messages 13513 Registration date Status Moderator Last intervention -
pijaku Posted messages 13513 Registration date Status Moderator Last intervention -
Hello,
Here is my problem.
I declare my variables:
Public p_prev, r_prev, p_real, r_real As Date
Then I initialize them:
p_prev = Empty
p_real = Empty
r_prev = Empty
r_real = Empty
But as soon as I query them, here is the result:
p_prev =
p_real =
r_prev =
r_real = 00:00:00
And I don't understand at all why "r_real" returns "00:00:00"
Do you have any idea why or how this is happening?
Thank you
Configuration: Windows Vista / Firefox 35.0
Here is my problem.
I declare my variables:
Public p_prev, r_prev, p_real, r_real As Date
Then I initialize them:
p_prev = Empty
p_real = Empty
r_prev = Empty
r_real = Empty
But as soon as I query them, here is the result:
p_prev =
p_real =
r_prev =
r_real = 00:00:00
And I don't understand at all why "r_real" returns "00:00:00"
Do you have any idea why or how this is happening?
Thank you
Configuration: Windows Vista / Firefox 35.0
2 answers
Hello,
As you defined
--
Always zen
Perfection is attained, not when there is nothing more to add, but when there is nothing left to take away. Antoine de Saint-Exupéry
As you defined
r_real As Dateyour variable is in date format: this is only normal because a zero date is empty.
--
Always zen
Perfection is attained, not when there is nothing more to add, but when there is nothing left to take away. Antoine de Saint-Exupéry
Hello,
I would like to add to gbinforme's response (greetings, by the way) that this declaration:
is equivalent to:
In VBA, you need to specify the type for each variable. So:
That's why you get:
Before, I could never finish my sentences... but now I
I would like to add to gbinforme's response (greetings, by the way) that this declaration:
Public p_prev, r_prev, p_real, r_real As Date
is equivalent to:
Public p_prev As Variant, r_prev As Variant, p_real As Variant, r_real As Date
In VBA, you need to specify the type for each variable. So:
Public p_prev As Date, r_prev As Date, p_real As Date, r_real As Date
That's why you get:
p_prev =
p_real =
r_prev =
r_real = 00:00:00
Before, I could never finish my sentences... but now I