SubForm entry triggered by Form chkbox click

N

Nancy Docken

Hi,

I have a form with a subform. I want to do two things
automatically when I click on a checkbox on the parent
form.

1. I want the subform to appear. (This is working)
2. I want today's date automatically entered into a field
on the subform. (This is NOT working.)

The default value of the checkbox is set to "false". The
control source of the subform field contains this code
(without the outer quotes, of course):

"=If(Forms!fMainform!Checkbox=True,Date(),"")"

All I'm getting is #Name?. Any suggestions? I've tried
lots of fixes, but no luck so far. Thanks for any help
you can offer.
 
M

Marshall Barton

Nancy said:
I have a form with a subform. I want to do two things
automatically when I click on a checkbox on the parent
form.

1. I want the subform to appear. (This is working)
2. I want today's date automatically entered into a field
on the subform. (This is NOT working.)

The default value of the checkbox is set to "false". The
control source of the subform field contains this code
(without the outer quotes, of course):

"=If(Forms!fMainform!Checkbox=True,Date(),"")"

All I'm getting is #Name?.


The name of the function is IIf. If is a VBA statement.

But that might not do what you want. If not, you could use
a little VBA in the check box's AfterUpdate event:

Me.subform.Visible = Me.thecheckbox
If Me.thecheckbox = True
Me.subform.Form.thedatetetbox = Date()
End If
 

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