what's wrong with this expr.

  • Thread starter Thread starter keyur
  • Start date Start date
K

keyur

hi

i dont know wht's wrong with this

check8 - checkbox
Completion Date - Text box with field type as date

and this is the expresion for click event of the check8

=iff([Check8]=True,[Completion Date]=Date())

Thanks for any help
Keyur

PS: you might have guessed that i am new to this stuff.
 
keyur said:
hi

i dont know wht's wrong with this

check8 - checkbox
Completion Date - Text box with field type as date

and this is the expresion for click event of the check8

=iff([Check8]=True,[Completion Date]=Date())

Thanks for any help
Keyur

PS: you might have guessed that i am new to this stuff.

If your intention is to set the [Completion Date] text box to the
current date when the check box is clicked, you can't do it this way.
You can't execute an assignment statement -- e.g., "[Completion
Date]=Date()" -- in an event property or in an argument to a function.
Instead, create an event procedure for the Check8 control's Click event.
Set its OnClick property to "[Event Procedure]", click the "build"
button (captioned "...") that will appear at the end of the property
line, and enter this as the event procedure:

Private Sub Check8_Click()

If Me!Check8 = True Then
Me![Completion Date] = Date
End If

End Sub

Note that the code, as written, won't clear the [Completion Date] if you
later un-check the check box. If you wanted to do that, you would havwe
to revise it like this:

If Me!Check8 = True Then
Me![Completion Date] = Date
Else
Me![Completion Date] = Null
End If

Personally, I'd use the check box's AfterUpdate event for this, not the
Click event, but the Click event should work, I think.
 
Thanks a lot.
-----Original Message-----
hi

i dont know wht's wrong with this

check8 - checkbox
Completion Date - Text box with field type as date

and this is the expresion for click event of the check8

=iff([Check8]=True,[Completion Date]=Date())

Thanks for any help
Keyur

PS: you might have guessed that i am new to this stuff.

If your intention is to set the [Completion Date] text box to the
current date when the check box is clicked, you can't do it this way.
You can't execute an assignment statement -- e.g., "[Completion
Date]=Date()" -- in an event property or in an argument to a function.
Instead, create an event procedure for the Check8 control's Click event.
Set its OnClick property to "[Event Procedure]", click the "build"
button (captioned "...") that will appear at the end of the property
line, and enter this as the event procedure:

Private Sub Check8_Click()

If Me!Check8 = True Then
Me![Completion Date] = Date
End If

End Sub

Note that the code, as written, won't clear the [Completion Date] if you
later un-check the check box. If you wanted to do that, you would havwe
to revise it like this:

If Me!Check8 = True Then
Me![Completion Date] = Date
Else
Me![Completion Date] = Null
End If

Personally, I'd use the check box's AfterUpdate event for this, not the
Click event, but the Click event should work, I think.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
 
Back
Top