Iif in a Form

R

Rags

Hello,

I'm a new user and trying to figure out how to get iif to work in a form.
I have a 'Complete' field (Yes/No) check box and a 'Completetime' field in my
record. When I check off the 'Complete' box I want the current date (NOW())
and time to populate the 'Completetime' field automatically. I've looked over
this board on iif questions and haven't quite figured out the correct syntax.
Any help would be appreciated?

Thanks.
 
K

Keith Wilby

Rags said:
Hello,

I'm a new user and trying to figure out how to get iif to work in a form.
I have a 'Complete' field (Yes/No) check box and a 'Completetime' field in
my
record. When I check off the 'Complete' box I want the current date
(NOW())
and time to populate the 'Completetime' field automatically. I've looked
over
this board on iif questions and haven't quite figured out the correct
syntax.
Any help would be appreciated?

I'd use a regular If, not an in-line one, in the check box's after update
event (untested):

If Me.chkMyCheckBox Then Me.txtMyTextField = Now()

Keith.
www.keithwilby.com
 
R

Rags

Tried that and getting message about 'Macro or macro group doen't exist or
macro's new and hasn't been saved'. Do I need to create a macro for this?

Thanks.
 
D

Douglas J Steele

You need to create an Event Procedure, and then type what Keith gave you
into that procedure.
 
U

UncleOli

To keep things simple, you don't really need an iif statement. Try this
instead:

In the AfterUpdate event for the Complete check box, create an event
procedure with the following line of programming:

Me!CompleteTime = Now()

Note that this will update your CompleteTime field (I'm assuming it's a text
box) whenever there is any change to the Complete field check box (whether
it's turned on or off).

I hope this helps,
(e-mail address removed)
02.01.06 20.02 hst
 
R

Rags

I got it to work using iif within an event procedure on the checkbox click
module. Works fine. Erases it if you uncheck.

Thanks for all the help.
 

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