Change date IF making checkbox "yes"

paindivine

Registered User.
Local time
Yesterday, 17:33
Joined
Dec 13, 2006
Messages
23
This is what I have on my form:

StartDate / EndDate / Ignore?

Startdate = Now
EndDate has no default
and Ignore is a Yes/No checkbox

What I want is for the EndDate to be blank... unless you check the ignore box. In which case the EndDate defaults to StartDate+4Hours. I can figure out how to get it to default:
=[Start Time]+TimeSerial(4,0,0)
But how can I get it to only do that when you check the Ignore checkbox?
I tried putting this into the "AfterUpdate" of the checkbox:
=IIf([Ignore]=Yes,[End Time]=[Start Time]+TimeSerial(4,0,0))
But it didn't work.

I don't really know much about If/Then Statements in Access so any help anyone can provide would be appretiated.
 
I would remove the blanks from your field names as they always cause syntax difficulties and then try

IIf(me.Ignore=Yes,me.EndTime=me.StartTime+TimeSerial(4,0,0))

Brian

edit In the afterupdate event I would use

if me.Ignore=Yes then me.EndTime=me.StartTime+TimeSerial(4,0,0)
 
Try:
Code:
If Me.Ignore Then
   Me.[End Time]=Me.[Start Time]+TimeSerial(4,0,0)
Else
   Me.[End Time]= Empty
End If
 
Try:
Code:
If Me.Ignore Then
   Me.[End Time]=Me.[Start Time]+TimeSerial(4,0,0)
Else
   Me.[End Time]= Empty
End If

That worked great! I made 1 change:

Code:
If Me.Ignore Then
   Me.[End Time]=Me.[Start Time]+TimeSerial(4,0,0)
Else
   Me.[End Time]= Null
End If

The 0000 date that "Empty" made would mess up my query

Thanks!!!
 

Users who are viewing this thread

Back
Top Bottom