Form View - Need to populate a value based on another field

J

jim

I have a form attached to a table. In my table I have a
field whose data type is yes/no. I have another field
whose data type is date. I want to have my date field
populated when the user click the field with the yes/no
data type.

ex. I have two fields, field one is the yes/no and field
two is the date filed. I click on the check box and I
want to automatically populate the date filed, so yes = now
().

Does this require a module? If yes can you show me how.

Thanks,

Jim
 
A

Aldo

Hi Jim,

This would require some code to be written. Please check
the sample code below.

I created a table with 2 fields in it:
First Field Second Field
name: usersel name: todaydate
type: yes/no type: date/time

In the AfterUpdate event of the field "usersel", put the
following code:

If Me.usersel = -1 Then
Me.todaydate = Now()
DoCmd.Requery
ElseIf Me.usersel = 0 Then
Me.todaydate = Null
DoCmd.Requery
End If


I hope this helps solve your problem.

Have a good day,
Aldo
 

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