Date field - programming

L

Liat

I have a MDB file that contains 1 main table
called "tviot" which is filled by a form.

It has identical details and 3 fields of estimation
dates, 3 fields of estimation values.

I have a report that should show the last date. for
that I wrote a function that gets 3 field of date and
returns the last one of them. I built a query that her
fields are the results of the function - this is related
to the report

The problem is that if one of those fields is empty, he
doesn't get into the function.

Trying to resolve this problem, I initialized the text
fields with #09/09/9999# and if the value of a field is
that initialized value, then I change the font color to
white (so it will look like empty).
The problem that this doesn't solve is - if a user
starts to write and then deletes, so again, I have an
empty value in the field. I tried to use
the "BeforeUpdate" function in order to put the
#09/09/9999# value in case the field is empty, but it
brings an error, saying that this is not a valid value.

If that is not clear yet so above is more detailed
explanation:

In the fields of the query, I call the function
GetLastEstimation([tviot]![estimation1], [tviot]!
[estimation2], [tviot]![estimation3], [tviot]!
[estimation1Date], [tviot]![estimation2 Date], [tviot]!
[estimation3 Date], [Forms]![F_Menu]![From_Date],[Forms]!
[F_Menu]![To_Date],[Forms]![F_Menu]![DateV]). This
function returns the last estimation. (for example, if
the date of estimation2 is empty then return estimation1)
The reason I send all those fields as parameters is that
I didn't succeed to get their values by code.
My problem is that if one of those fields is empty, the
function is not being called.
I tried to resolve this problem by putting a default
value in those fields.
But that caused other problem - if someone regrets and
deletes the date he entered, then this field becomes
empty and we return to the original problem.
In the function "beforeUpdate" I tried to check whether
the field is empty and if so to put the default value but
when I ran this' an error message appeared that the value
is not standing in the rules.


Thanks a lot,
Liat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top