How do I get my info from second form to the first.

C

Carol G

I have a button on a subform to export a record to Outlook contacts.
Before it is exported though I check to see if there is another record or
more in Outlook.
If there is I have another form which I use the docmd to open passing the
duplicate info to the second form. (this form is like the message form that
outlook triggers when a vcard is a duplicate.
The trouble is that I need the information back that the user has chosen
from the second form (either update, make new record, cancel) to continue
the code to export to Outlook from the first form.
As you can see below it is only half done.
Can I somehow get the data from the form I opened back to the sub routine
that called it.
All the code is in the forms. No modules. Hope this makes sense.
Thanks for the help.
Carol

Private Sub Export_Click() ' This button is on the calling form.

Dim fld As Outlook.MAPIFolder
Dim appOutlook As Outlook.Application
Dim nms As Outlook.NameSpace
Dim itms As Outlook.Items
Dim itm As Outlook.ContactItem
Dim strNameList As String

Set appOutlook = CreateObject("Outlook.Application")
Set nms = appOutlook.GetNamespace("MAPI")
Set fld = nms.GetDefaultFolder(olFolderContacts) 'Set what kind of folder
Set itms = fld.Items 'Outlook folder item

On Error GoTo ErrorHandler

'Check Outlook for duplicates

For Each itm In itms
If strLName1 = itm.LastName Then
strNameList = strNameList & "," & itm.FullName
'Debug.Print strNameList
End If

Next

Debug.Print "Looped through list"
MsgBox "Looped through list"

DoCmd.OpenForm "frmDuplicateValue", OpenArgs:=strNameList
 

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