Extracting data from a sub form 
Author Message
 Extracting data from a sub form

Hi Guys,

As simple questions for most.
I have a form (Main) with a subform(Contacts) that has a
Text box field(Email). I was trying to extract
the "Email"'s for the current "Main" record using the For
Each Next command. But I am not having any luck.

The Subform lists all the contacts that are interested in
a topic(Main). I want to then be able to press a command
button to extract the ContactId Email addresses and place
them into the "To" field in an email. I can do every else
other than get the data to put the email list together.

Any help will be greatly appreciated.

Robert



Tue, 19 Apr 2005 06:24:30 GMT  
 Extracting data from a sub form

Quote:

>As simple questions for most.
>I have a form (Main) with a subform(Contacts) that has a
>Text box field(Email). I was trying to extract
>the "Email"'s for the current "Main" record using the For
>Each Next command. But I am not having any luck.

>The Subform lists all the contacts that are interested in
>a topic(Main). I want to then be able to press a command
>button to extract the ContactId Email addresses and place
>them into the "To" field in an email. I can do every else
>other than get the data to put the email list together.

If I understand the question, it's not all that simple, but
not too difficult either.  Here's some air code that should
get you started.

In your button's click event procedure:

Dim strEmails As String
With Me.subformcontrol.Form.RecordsetClone
        .MoveFirst
        Do Until .EOF
                strEmails = ", " & txtEmailAddr & strEmails
                .MoveNext
        Loop
End With
strEmails = Mid(strEmails, 3)

At this point, strEmails has the list ot To addresses.  How
you stuff it in to an emailer is up to you.

--
Marsh
MVP [MS Access]



Tue, 19 Apr 2005 07:08:48 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Extracting data from multiple tables, for use on a VB Form

2. Extracting files from a MIME(multipart/form-data) blob

3. Extract data form Active Directory

4. GoToRecord ,, acLast on Sub-Sub-Form not working

5. Can't access records with sub form for linked sub table

6. menus and sub-menus and sub-sub-menus

7. count elements in root, sub root sub-sub root treeview

8. Sub forms not in the Forms collection?

9. Problems Adding Records from a Form containing a Sub-form

10. Kernel Error on Form Sub Form

11. a solution to growing mdb's and how to undo a form with sub-form

12. filter on an form and a sub form ...

 

 
Powered by phpBB® Forum Software