Coding Subforms in More than One Main Form

S

S Jackson

I have a subform called frmHearings. This subform contains 14 different
fields which contain dates (deadlines) and checkboxes for each deadline. My
subform is contained in three other main forms: frmMaster, frmMasterAll and
frmClosedDetail.

I have code added to the subform that first inspects to see if each checkbox
is checked and if not, adds each correspondeing deadline to Outlook as a
Task (User clicks a button "Add These Deadlines to Outlook"). A snippet of
the code looks like this:

With objTask
.Subject = Forms!frmMaster!CaseName & " / DHS No. " &
Forms!frmMaster!DHSNo
.DueDate = Me.HrgStart
.Body = "Hearing"
.ReminderSet = True
End With

Note that the subject line for the task being added comes from a fields on
the main form (frmMaster) called CaseName and DHSNo

Therein lies the problem. Do I need to create three different subforms for
each of the three main forms in order to accomodate that one line of code
that gets the subject line for the Task?

I thought about putting a hidden control on the subform that goes out and
gets these two fields from the main form, but I don't know how to do this.
If I could do this, then I could change that line of code to refer to Me!

I also am wondering if there is a way to write just one public procedure
that I can call from the subform that will inspect all the 14 checkbox
controls that indicate whether task has been added, and then if not, collect
the deadlines not checked and add them to Outlook.

As I have the code written now, I have had to rewrite the entire thing 14x
over for each control/deadline on the form.

Sorry this is so complicated.

S. Jackson
 
S

S Jackson

I solved this one on my own . . .. the answer is Parent!

As for the other business about having to repeat code 14x over - its much,
much to complicated to do otherwise, so I'll leave it at that.

S. Jackson
 

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