Form/subform checkbox Question

G

Guest

I hope someone can help me with this. I have a main form with a checkbox on
this form. I have a subform on this main form. When I check off the
checkbox, I would like the rows with the same ID in the subform to be filled
a date stamp in the date field in the subform. Can this be done, if so how?
thank you
 
G

Guest

Hi TC,

First of all, if you have a subform that is linked correctly using your link
child/link master fields it should only be showing relevant records for that
selected on the main form.

Now, generally if you want to do something when you tick a checkbox use the
after update or on click event. In that code, check for whether it is now
true or false, as that will tell you whether it was ticked or unticked eg:
if me.CHECKBOX then
' true - must be ticked
else
' false - must be unticked
endif

From there, you can apply whatever conditions you want to enforce. The
question is why you want multiple dates to be populated in the subform...
surely if the same date is stored for every record (that is linked to the
main form), the place for that date would be in the main table, not the
linked subform table.

Be that as it may, you could use an update query like this:

docmd.runsql "update SUBTABLE set FIELD = #" & format(date(), "yyyy/mm/dd")
& "# where ID = " & me.lngIDFIELD

Hope this helps.

Damian.
 

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