Updating the Form using the Yes/No

T

TomP

Hello:

I have a field in my table that I set it in text format and set to one
character in length. I would like that field to automatically update to show
a "Y" or "N". We'll call this fieldname YESNO

I also have a field in my table that is in Date/Time format. We'll call
this fieldname DATE

Question:
How can I write a code to automatically update my YESNO field if there is a
date in the DATE field?

This is what I entered in the After Update in the DATE field and could not
make it work consistently. For example, I would enter a date and go back to
remove the date to see if the YESNO field will reflect the change.

If Me.DATE= True Then
Me.YESNO = "Y"
Else
Me.YESNO = "N"
End If

The reason I chose to format the YES/NO to text is that I would like to use
that field in my report to show a "Y" and "N" character in my report rather
than a check mark.

Thank you for your help!

Tom
 
G

Golfinray

It would be a lot easier to put a yes/no field in your table and then put a
checkbox on your form and bind it your date field. If there is a date check
if no no check.
 
T

TomP

How would you write the event code to have the check marks appear (and
disappear) automatically whenever there is a date entered in the date field?

Thank you,
 
M

Michael Gramelspacher

The reason I chose to format the YES/NO to text is that I would like to use
that field in my report to show a "Y" and "N" character in my report rather
than a check mark.

Sounds like just a computed column in the query behind your report.

=Iif(Isnull(some_date),"N","Y")
 
R

Rick Brandt

TomP said:
How would you write the event code to have the check marks appear (and
disappear) automatically whenever there is a date entered in the date
field?

You don't need any code. A CheckBox bound to a DateTime field will display
"checked" when the underyling field has any non-null entry and "un-checked"
when there is a null.
 

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