Clearing Set Value for Date Entry

J

Julius

Hello all, can someone help me with this asap please. I have a macro where
if I put a checkmark in a checkbox the date will appear in the textbox.
However I want the date to disappear if I remove the checkbox, how can I
accoplish this. This is what I have

[Forms]![frm_view_all_closed_issues]![Reopened Date]
Now()
 
S

Steve Schapel

Julius,

Assuming the textbox is on the same form as the checkbox, i.e. the
frm_view_all_closed_issues form, there is no need to specify the form.
Also, the Now() function returns the curent date *and time*. If you
only want the date, you should use the Date() function instead.

Therefore, the arguments for your SetValue action will be like this:
Item: [Reopened Date]
Expression: Date()

To clear the date box when the checkbox is unticked:
Item: [Reopened Date]
Expression: Null
 
G

ggerke

Julius,

If you click on the "Conditions" column for the macro you can check the
status of the check box. Call the Macro in the Afterupdate property of the
checkbox. So there would be two lines, one if the check box was true and one
if it were false, i.e [check box]=True --- SetValue Textbox to Now() and
[check box]=False --- SetValue Textbox=""
Try that one
 
J

Julius

ok so I tried both ways listed. The first way gives me a error message
saying access can not parse the expression. The second It takes on the later
of the set value, so when I put a check mark in the checkbox it leaves the
date field blank.

ggerke said:
Julius,

If you click on the "Conditions" column for the macro you can check the
status of the check box. Call the Macro in the Afterupdate property of the
checkbox. So there would be two lines, one if the check box was true and one
if it were false, i.e [check box]=True --- SetValue Textbox to Now() and
[check box]=False --- SetValue Textbox=""
Try that one

Julius said:
Hello all, can someone help me with this asap please. I have a macro where
if I put a checkmark in a checkbox the date will appear in the textbox.
However I want the date to disappear if I remove the checkbox, how can I
accoplish this. This is what I have

[Forms]![frm_view_all_closed_issues]![Reopened Date]
Now()
 
J

Julius

I think I am still doing something wrong so forgive my ignorance please.
show me how you would input that. I have Setvalue twice once for =Date() and
the other for Null, when I put the checkmark in the box nothing happens the
date doesn't even appear. I know I am doing this wrong. How would I input
this into the expression field of the SetValue Action, please advise.

Steve Schapel said:
Julius,

Assuming the textbox is on the same form as the checkbox, i.e. the
frm_view_all_closed_issues form, there is no need to specify the form.
Also, the Now() function returns the curent date *and time*. If you
only want the date, you should use the Date() function instead.

Therefore, the arguments for your SetValue action will be like this:
Item: [Reopened Date]
Expression: Date()

To clear the date box when the checkbox is unticked:
Item: [Reopened Date]
Expression: Null

--
Steve Schapel, Microsoft Access MVP
Hello all, can someone help me with this asap please. I have a macro where
if I put a checkmark in a checkbox the date will appear in the textbox.
However I want the date to disappear if I remove the checkbox, how can I
accoplish this. This is what I have

[Forms]![frm_view_all_closed_issues]![Reopened Date]
Now()
 
J

Julius

I just realize something I understand what you said to do, however I want to
use this function together, meaning if I put a checkmark in the box and
change my mind and take it out I want the date to disappear from the date
textbox. Looking at what you said to do, one will cancel out the other,
because I tried using two SetValues and based on your instructions and again
one cancells out the other.

Steve Schapel said:
Julius,

Assuming the textbox is on the same form as the checkbox, i.e. the
frm_view_all_closed_issues form, there is no need to specify the form.
Also, the Now() function returns the curent date *and time*. If you
only want the date, you should use the Date() function instead.

Therefore, the arguments for your SetValue action will be like this:
Item: [Reopened Date]
Expression: Date()

To clear the date box when the checkbox is unticked:
Item: [Reopened Date]
Expression: Null

--
Steve Schapel, Microsoft Access MVP
Hello all, can someone help me with this asap please. I have a macro where
if I put a checkmark in a checkbox the date will appear in the textbox.
However I want the date to disappear if I remove the checkbox, how can I
accoplish this. This is what I have

[Forms]![frm_view_all_closed_issues]![Reopened Date]
Now()
 
S

Steve Schapel

Julius,

Aha! You need to put in some Conditions in the macro.

Condition: [NameOfYourCheckbox]=-1
Action: SetValue
Item: [Reopened Date]
Expression: Date()

Condition: [NameOfYourCheckbox]=0
Action: SetValue
Item: [Reopened Date]
Expression: Null

Also, I assume you have the macro assigned in the right place - which I
think would be the After Update event of the checkbox.
 
J

Julius

You are the man, thank you so very much, I did not setup the conditions
correctly. Have a very blessed remainder of day.

Steve Schapel said:
Julius,

Aha! You need to put in some Conditions in the macro.

Condition: [NameOfYourCheckbox]=-1
Action: SetValue
Item: [Reopened Date]
Expression: Date()

Condition: [NameOfYourCheckbox]=0
Action: SetValue
Item: [Reopened Date]
Expression: Null

Also, I assume you have the macro assigned in the right place - which I
think would be the After Update event of the checkbox.

--
Steve Schapel, Microsoft Access MVP
I just realize something I understand what you said to do, however I want to
use this function together, meaning if I put a checkmark in the box and
change my mind and take it out I want the date to disappear from the date
textbox. Looking at what you said to do, one will cancel out the other,
because I tried using two SetValues and based on your instructions and again
one cancells out the other.
 

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

Similar Threads


Top